Class CookieTenantResolver
java.lang.Object
io.micronaut.multitenancy.tenantresolver.CookieTenantResolver
- All Implemented Interfaces:
HttpRequestTenantResolver
,TenantResolver
@Singleton
@Requires(beans=CookieTenantResolverConfiguration.class) @Requires(property="micronaut.multitenancy.tenantresolver.cookie.enabled",value="true",defaultValue="false")
public class CookieTenantResolver
extends Object
implements TenantResolver, HttpRequestTenantResolver
A
TenantResolver
that resolves the tenant from a request cookie.- Since:
- 1.0.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from interface io.micronaut.multitenancy.tenantresolver.TenantResolver
ALL, DEFAULT, PREFIX
-
Constructor Summary
ConstructorDescriptionCookieTenantResolver
(@NonNull CookieTenantResolverConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescription@NonNull String
Resolves the current tenant identifier.@NonNull String
resolveTenantId
(@NonNull io.micronaut.http.HttpRequest<?> request) Resolves the current tenant identifier.@NonNull Serializable
Deprecated, for removal: This API element is subject to removal in a future version.@NonNull Serializable
resolveTenantIdentifier
(@NonNull io.micronaut.http.HttpRequest<?> request) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
cookiename
The name of the header.
-
-
Constructor Details
-
CookieTenantResolver
- Parameters:
configuration
-CookieTenantResolver
configuration
-
-
Method Details
-
resolveTenantIdentifier
@Deprecated(forRemoval=true, since="5.5.0") @NonNull public @NonNull Serializable resolveTenantIdentifier() throws TenantNotFoundExceptionDeprecated, for removal: This API element is subject to removal in a future version.UseresolveTenantId()
insteadDescription copied from interface:TenantResolver
Resolves the current tenant identifier.
In a Multi Tenant setup where a single database is being used amongst multiple tenants this would be the object that is used as the tenantId property for each domain class.
- Specified by:
resolveTenantIdentifier
in interfaceTenantResolver
- Returns:
- the tenant ID if resolved.
- Throws:
TenantNotFoundException
- if tenant not found
-
resolveTenantIdentifier
@Deprecated(forRemoval=true, since="5.5.0") @NonNull public @NonNull Serializable resolveTenantIdentifier(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request) throws TenantNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:HttpRequestTenantResolver
Resolves the current tenant identifier.- Specified by:
resolveTenantIdentifier
in interfaceHttpRequestTenantResolver
- Parameters:
request
- The HTTP request- Returns:
- The tenant identifier
- Throws:
TenantNotFoundException
- if tenant not found
-
resolveTenantId
Description copied from interface:TenantResolver
Resolves the current tenant identifier.
In a Multi Tenant setup where a single database is being used amongst multiple tenants this would be the object that is used as the tenantId property for each domain class.
- Specified by:
resolveTenantId
in interfaceTenantResolver
- Returns:
- the tenant ID if resolved.
- Throws:
TenantNotFoundException
- if tenant not found
-
resolveTenantId
@NonNull public @NonNull String resolveTenantId(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request) throws TenantNotFoundException Description copied from interface:HttpRequestTenantResolver
Resolves the current tenant identifier.- Specified by:
resolveTenantId
in interfaceHttpRequestTenantResolver
- Parameters:
request
- The HTTP request- Returns:
- The tenant identifier
- Throws:
TenantNotFoundException
- if tenant not found
-
resolveTenantId()
instead