@Singleton @Requires(beans=HttpHeaderTenantResolverConfiguration.class) @Requires(property="micronaut.multitenancy.tenantresolver.httpheader.enabled",value="true",defaultValue="false") public class HttpHeaderTenantResolver extends Object implements TenantResolver
TenantResolver that resolves the tenant from the request HTTP Header.| Modifier and Type | Field and Description |
|---|---|
protected String |
headerName
The name of the header.
|
ALL, DEFAULT, PREFIX| Constructor and Description |
|---|
HttpHeaderTenantResolver(HttpHeaderTenantResolverConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
Serializable |
resolveTenantIdentifier()
Resolves the current tenant identifier.
|
protected Serializable |
resolveTenantIdentifierAtRequest(HttpRequest<Object> request) |
protected String headerName
public HttpHeaderTenantResolver(HttpHeaderTenantResolverConfiguration configuration)
configuration - HttpHeaderTenantResolverConfiguration configurationpublic Serializable resolveTenantIdentifier() throws TenantNotFoundException
TenantResolverResolves 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 TenantResolverTenantNotFoundException - if tenant not foundprotected Serializable resolveTenantIdentifierAtRequest(HttpRequest<Object> request) throws TenantNotFoundException
request - The HTTP requestTenantNotFoundException - A exception thrown if the tenant could not be resolved.