Class AbstractSubdomainTenantResolver
java.lang.Object
io.micronaut.multitenancy.tenantresolver.AbstractSubdomainTenantResolver
- All Implemented Interfaces:
HttpRequestTenantResolver
,TenantResolver
- Direct Known Subclasses:
InternetDomainNameSubdomainTenantResolver
,PublicSuffixListSubdomainTenantResolver
,SubdomainTenantResolver
public abstract class AbstractSubdomainTenantResolver
extends Object
implements TenantResolver, HttpRequestTenantResolver
Abstract class for a tenant resolver that resolves the tenant from the Subdomain.
- Since:
- 5.1.0
- Author:
- Sergio del Amo
-
Field Summary
Modifier and TypeFieldDescriptionprotected io.micronaut.http.server.util.HttpHostResolver
Http Host resolver.Fields inherited from interface io.micronaut.multitenancy.tenantresolver.TenantResolver
ALL, DEFAULT, PREFIX
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSubdomainTenantResolver
(io.micronaut.http.server.util.HttpHostResolver httpHostResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @NonNull Serializable
resolveSubdomain
(@NonNull String host) @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
-
httpHostResolver
protected io.micronaut.http.server.util.HttpHostResolver httpHostResolverHttp Host resolver.
-
-
Constructor Details
-
AbstractSubdomainTenantResolver
protected AbstractSubdomainTenantResolver(io.micronaut.http.server.util.HttpHostResolver httpHostResolver) - Parameters:
httpHostResolver
- HTTP host resolver.
-
-
Method Details
-
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 identifier
-
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
-
resolveTenantIdentifier
@NonNull @Deprecated(forRemoval=true, since="5.5.0") public @NonNull Serializable resolveTenantIdentifier()Deprecated, for removal: This API element is subject to removal in a future version.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:
resolveTenantIdentifier
in interfaceTenantResolver
- Returns:
- The tenant identifier
-
resolveTenantIdentifier
@NonNull @Deprecated(forRemoval=true, since="5.5.0") 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
-
resolveSubdomain
- Parameters:
host
- Host- Returns:
- The subdomain.
-