public interface TenantFacade
Tenant
information.Modifier and Type | Method and Description |
---|---|
Tenant |
getCurrentTenant()
Returns the current
Tenant . |
Optional<Tenant> |
getCurrentTenantIfAvailable()
Returns the current
Tenant , if available. |
Class<? extends Tenant> |
getTenantClass()
Returns the platform-specific implementation class of
Tenant . |
Optional<Tenant> |
resolveCurrentTenant()
Resolves the current
Tenant using the platform-specific lookup. |
io.vavr.control.Try<Tenant> |
tryGetCurrentTenant()
Returns a
Try for the current Tenant . |
@Nonnull Class<? extends Tenant> getTenantClass()
Tenant
. For internal use only.@Nonnull Optional<Tenant> resolveCurrentTenant() throws TenantAccessException
Tenant
using the platform-specific lookup. For more details on the availability of a
tenant, refer to getCurrentTenantIfAvailable()
.
For internal use only.
Caution: This method must only be invoked within the container-managed thread of a request.
Optional
of the current Tenant
.TenantAccessException
- If there is an issue while resolving the Tenant
.TenantRequestContextListener
@Nonnull Tenant getCurrentTenant() throws TenantNotAvailableException, TenantAccessException
Tenant
.Tenant
.TenantNotAvailableException
- If there is currently no Tenant
available. This typically occurs when trying to access the
tenant within code that is running outside any tenant context, e.g., within a background task. For
more details on how the availability of a tenant is defined, refer to
getCurrentTenantIfAvailable()
.TenantAccessException
- If there is an issue while accessing the Tenant
.@Nonnull Optional<Tenant> getCurrentTenantIfAvailable() throws TenantAccessException
Tenant
, if available.
The availability of the tenant is defined as follows:
Tenant available | Tenant not available | |
---|---|---|
SAP Cloud Platform Cloud Foundry | A request is present with an "Authorization" header that contains a valid JWT bearer with field "zid". | A request is not available, no "Authorization" header is present in the current request, or the JWT bearer does not hold a field "zid". |
SAP Cloud Platform Neo | Successful JNDI lookup of TenantContext. | Never. If correctly configured, a TenantContext is always available. If not, a TenantAccessException
is thrown. |
Optional
of the current Tenant
.TenantAccessException
- If there is an issue while accessing the Tenant
.Copyright © 2019 SAP SE. All rights reserved.