Class SessionTenantResolver
- java.lang.Object
-
- io.micronaut.multitenancy.tenantresolver.SessionTenantResolver
-
- All Implemented Interfaces:
HttpRequestTenantResolver,TenantResolver
@Requires(classes={io.micronaut.session.Session.class,io.micronaut.session.http.HttpSessionFilter.class}) @Requires(beans=SessionTenantResolverConfiguration.class) @Requires(property="micronaut.multitenancy.tenantresolver.session.enabled",value="true",defaultValue="false") @Singleton public class SessionTenantResolver extends java.lang.Object implements TenantResolver, HttpRequestTenantResolverResolves the tenant id from the user HTTP session.- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.multitenancy.tenantresolver.TenantResolver
ALL, DEFAULT, PREFIX
-
-
Constructor Summary
Constructors Constructor Description SessionTenantResolver(SessionTenantResolverConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.SerializableresolveTenantIdentifier()Resolves the current tenant identifier.java.io.SerializableresolveTenantIdentifier(@NotNull io.micronaut.http.HttpRequest<?> request)Resolves the current tenant identifier.
-
-
-
Constructor Detail
-
SessionTenantResolver
public SessionTenantResolver(SessionTenantResolverConfiguration configuration)
- Parameters:
configuration-SessionTenantResolverConfigurationconfiguration.
-
-
Method Detail
-
resolveTenantIdentifier
@NonNull public java.io.Serializable resolveTenantIdentifier() throws TenantNotFoundExceptionDescription copied from interface: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.
- Specified by:
resolveTenantIdentifierin interfaceTenantResolver- Returns:
- The tenant identifier
- Throws:
TenantNotFoundException- if tenant not found
-
resolveTenantIdentifier
@NonNull public java.io.Serializable resolveTenantIdentifier(@NonNull @NotNull @NotNull io.micronaut.http.HttpRequest<?> request) throws TenantNotFoundExceptionDescription copied from interface:HttpRequestTenantResolverResolves the current tenant identifier.- Specified by:
resolveTenantIdentifierin interfaceHttpRequestTenantResolver- Parameters:
request- The HTTP request- Returns:
- The tenant identifier
- Throws:
TenantNotFoundException- if tenant not found
-
-