@Override
    public Optional<TenantDefinition> extract(final String requestPath) {
        val tenantId = casProperties.getMultitenancy().getCore().isEnabled()
            ? TenantExtractor.tenantIdFromPath(requestPath)
            : StringUtils.EMPTY;
        return StringUtils.isNotBlank(tenantId) ? tenantsManager.findTenant(tenantId) : Optional.empty();
    }
This is {@link DefaultTenantExtractor}.

@author Misagh Moayyed
@since 7.2.0
core/cas-server-core-multitenancy/src/main/java/org/apereo/cas/multitenancy/DefaultTenantExtractor.java