Skip to content

Commit

Permalink
fix business admin roles issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshani committed Feb 26, 2024
1 parent d3ce6da commit d2f746f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.wso2.carbon.identity.application.common.model.IdentityProvider;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationConstants;
import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils;
import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataHandler;
import org.wso2.carbon.identity.claim.metadata.mgt.exception.ClaimMetadataException;
Expand Down Expand Up @@ -198,7 +199,10 @@ protected Map<String, String> handleFederatedClaims(Map<String, String> remoteCl
String serviceProviderMappedUserRoles;

boolean useAppAssociatedRoles = isAppRoleResolverExists() || !CarbonConstants.ENABLE_LEGACY_AUTHZ_RUNTIME;
if (useAppAssociatedRoles) {
boolean excludeSuperTenantForLegacyRolesClaim =
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(context.getTenantDomain()) &&
Boolean.parseBoolean(IdentityUtil.getProperty(IdentityConstants.ALLOW_LEGACY_AUTHZ_CLAIMS));
if (useAppAssociatedRoles && !excludeSuperTenantForLegacyRolesClaim) {
// This handles the idp group to local role assignments in the new authz flow.
String idpGroupClaimUri = FrameworkUtils.getEffectiveIdpGroupClaimUri(stepConfig, context);
boolean idpGroupsExists = isIdpGroupsExistForIDP(context.getExternalIdP().getIdentityProvider());
Expand Down Expand Up @@ -755,7 +759,8 @@ protected Map<String, String> handleLocalClaims(String spStandardDialect,
.getMultiAttributeSeparator(), appAssociatedRoles));
}
} else {
if (isRoleClaimRequested) {
if (isRoleClaimRequested && !Boolean.parseBoolean(IdentityUtil.getProperty(
IdentityConstants.ALLOW_LEGACY_AUTHZ_CLAIMS))) {
allLocalClaims.put(rolesClaimURI, String.join(FrameworkUtils.getMultiAttributeSeparator(),
StringUtils.EMPTY));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public class IdentityConstants {

public static final String IDENTITY_UTIL_ENABLE_SHA256 = "IdentityUtil.EnableSHA256";
public static final String CERT_THUMBPRINT_ENABLE_SHA256 = "CertThumbprint.EnableSHA256";
public static final String ALLOW_LEGACY_AUTHZ_CLAIMS = "AllowLegacyAuthzClaims";

private IdentityConstants() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3953,4 +3953,9 @@

<SuperTenantAliasInPublicUrl>{{super_tenant.alias_in_public_url}}</SuperTenantAliasInPublicUrl>

{% if legacy_claims.allow_roles is defined %}
<!-- Config to allow legacy roles claim behaviors -->
<AllowLegacyAuthzClaims>{{legacy_claims.allow_roles}}</AllowLegacyAuthzClaims>
{% endif %}

</Server>
Original file line number Diff line number Diff line change
Expand Up @@ -1516,5 +1516,6 @@

"super_tenant.alias_in_public_url": "",
"connector.challenge_questions.enable": false,
"tenant_mgt.enable_email_domain": false
"tenant_mgt.enable_email_domain": false,
"legacy_claims.allow_roles": false
}

0 comments on commit d2f746f

Please sign in to comment.