@Singleton @Requires(beans=CookieTenantResolverConfiguration.class) @Requires(property="micronaut.multitenancy.tenantresolver.cookie.enabled",value="true",defaultValue="false") public class CookieTenantResolver extends java.lang.Object implements TenantResolver, HttpRequestTenantResolver
TenantResolver
that resolves the tenant from a request cookie.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
cookiename
The name of the header.
|
ALL, DEFAULT, PREFIX
Constructor and Description |
---|
CookieTenantResolver(CookieTenantResolverConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
java.io.Serializable |
resolveTenantIdentifier()
Resolves the current tenant identifier.
|
java.io.Serializable |
resolveTenantIdentifier(@NotNull io.micronaut.http.HttpRequest<?> request)
Resolves the current tenant identifier.
|
protected java.io.Serializable |
resolveTenantIdentifierAtRequest(io.micronaut.http.HttpRequest<java.lang.Object> request)
Deprecated.
Use
resolveTenantIdentifier(HttpRequest) instead. |
public CookieTenantResolver(CookieTenantResolverConfiguration configuration)
configuration
- CookieTenantResolver
configuration@NonNull public java.io.Serializable resolveTenantIdentifier() throws TenantNotFoundException
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.
resolveTenantIdentifier
in interface TenantResolver
TenantNotFoundException
- if tenant not found@NonNull public java.io.Serializable resolveTenantIdentifier(@NonNull @NotNull @NotNull io.micronaut.http.HttpRequest<?> request) throws TenantNotFoundException
HttpRequestTenantResolver
resolveTenantIdentifier
in interface HttpRequestTenantResolver
request
- The HTTP requestTenantNotFoundException
- if tenant not found@Deprecated protected java.io.Serializable resolveTenantIdentifierAtRequest(io.micronaut.http.HttpRequest<java.lang.Object> request) throws TenantNotFoundException
resolveTenantIdentifier(HttpRequest)
instead.request
- The HTTP requestTenantNotFoundException
- A exception thrown if the tenant could not be resolved.