@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
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.
|
protected java.io.Serializable |
resolveTenantIdentifierAtRequest(HttpRequest<java.lang.Object> request) |
public CookieTenantResolver(CookieTenantResolverConfiguration configuration)
configuration
- CookieTenantResolver
configurationpublic 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 foundprotected java.io.Serializable resolveTenantIdentifierAtRequest(HttpRequest<java.lang.Object> request) throws TenantNotFoundException
request
- The HTTP requestTenantNotFoundException
- A exception thrown if the tenant could not be resolved.