Skip to content

Commit

Permalink
Add new config to specify to append super tenant in URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla committed Oct 16, 2023
1 parent d503a1d commit 1667875
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.StringJoiner;

import static org.wso2.carbon.identity.core.util.IdentityCoreConstants.PROXY_CONTEXT_PATH;
import static org.wso2.carbon.identity.core.util.IdentityTenantUtil.isSuperTenantMandatoryInUrl;
import static org.wso2.carbon.identity.core.util.IdentityTenantUtil.isSuperTenantRequiredInUrl;

/**
* Implementation for {@link ServiceURLBuilder}.
Expand Down Expand Up @@ -125,7 +125,7 @@ protected String getResolvedUrlPath(String tenantDomain) {

if (IdentityTenantUtil.isTenantQualifiedUrlsEnabled() && !resolvedUrlContext.startsWith("t/") &&
!resolvedUrlContext.startsWith("o/")) {
if (mandateTenantedPath || isSuperTenantMandatoryInUrl() || isNotSuperTenant(tenantDomain)) {
if (mandateTenantedPath || isSuperTenantRequiredInUrl() || isNotSuperTenant(tenantDomain)) {
String organizationId = StringUtils.isNotBlank(orgId) ? orgId :
PrivilegedCarbonContext.getThreadLocalCarbonContext().getOrganizationId();
if (organizationId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public class IdentityCoreConstants {
public static final String PORTS_OFFSET = "Ports.Offset";

public static final String TENANT_NAME_FROM_CONTEXT = "TenantNameFromContext";
public static final String ENABLE_TENANT_QUALIFIED_URLS = "EnableTenantQualifiedUrls";
public static final String ENABLE_TENANTED_SESSIONS = "EnableTenantedSessions";
public static final String APPEND_SUPER_TENANT_IN_URL = "AppendSuperTenantInUrl";
public static final String ENABLE_TENANT_QUALIFIED_URLS = "TenantContext.TenantQualifiedUrls.Enable";
public static final String REQUIRED_SUPER_TENANT_IN_URL =
"TenantContext.TenantQualifiedUrls.TenantedSessions.Enable";
public static final String ENABLE_TENANTED_SESSIONS = "TenantContext.TenantQualifiedUrls.RequireSuperTenantDomain";
public static final String PROXY_CONTEXT_PATH = "ProxyContextPath";
public static final int DEFAULT_HTTPS_PORT = 443;
public static final String UTF_8 = "UTF-8";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public static boolean isTenantedSessionsEnabled() {
*/
public static boolean isSuperTenantRequiredInUrl() {

return Boolean.parseBoolean(IdentityUtil.getProperty(IdentityCoreConstants.APPEND_SUPER_TENANT_IN_URL));
return Boolean.parseBoolean(IdentityUtil.getProperty(IdentityCoreConstants.REQUIRED_SUPER_TENANT_IN_URL));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3214,9 +3214,17 @@
-->
<EnableFederatedUserAssociation>{{user.association.enable_for_federated_users}}</EnableFederatedUserAssociation>

<EnableTenantQualifiedUrls>{{tenant_context.enable_tenant_qualified_urls}}</EnableTenantQualifiedUrls>
<EnableTenantedSessions>{{tenant_context.enable_tenanted_sessions | default(false)}}</EnableTenantedSessions>
<AppendSuperTenantInUrl>{{tenant_context.append_super_tenant_in_url | default(false)}}</AppendSuperTenantInUrl>
<TenantContext>
<TenantQualifiedUrls>
<Enable>{{tenant_context.enable_tenant_qualified_urls}}</Enable>
<RequireSuperTenantDomain>{{tenant_context.require_super_tenant_in_url}}</RequireSuperTenantDomain>
</TenantQualifiedUrls>

<TenantedSessions>
<Enable>{{tenant_context.enable_tenanted_sessions}}</Enable>
</TenantedSessions>
</TenantContext>


<!--
When this property is set to 'true', if the username provided during the SaaS application authentication does
Expand Down

0 comments on commit 1667875

Please sign in to comment.