Class SubdomainTenantResolver

java.lang.Object
io.stargate.sgv2.api.common.tenant.impl.SubdomainTenantResolver
All Implemented Interfaces:
TenantResolver

public class SubdomainTenantResolver extends Object implements TenantResolver
TenantResolver that finds the tenant ID in the left most domain part of the host name.

For example, having tenant-id.domain.com will resolve tenant identifier to the tenant-id. In case of top-level domain, domain.com will resolve tenant identifier to the domain.

  • Constructor Details

  • Method Details

    • resolve

      public Optional<String> resolve(io.vertx.ext.web.RoutingContext context, jakarta.ws.rs.core.SecurityContext securityContext)
      Returns a tenant identifier given a RoutingContext and a SecurityContext.
      Specified by:
      resolve in interface TenantResolver
      Parameters:
      context - the routing context
      securityContext - the security context
      Returns:
      The tenant identifier. If empty, indicates that the multi-tenancy is disabled.