diff --git a/components/org.wso2.carbon.identity.scim2.common/pom.xml b/components/org.wso2.carbon.identity.scim2.common/pom.xml index ba81973fc..9d6788408 100644 --- a/components/org.wso2.carbon.identity.scim2.common/pom.xml +++ b/components/org.wso2.carbon.identity.scim2.common/pom.xml @@ -148,6 +148,10 @@ org.wso2.carbon.identity.organization.management.core org.wso2.carbon.identity.organization.management.service + + org.wso2.carbon.identity.event.handler.accountlock + org.wso2.carbon.identity.handler.event.account.lock + commons-lang commons-lang @@ -238,6 +242,8 @@ version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.identity.organization.management.service.*; version="${org.wso2.carbon.identity.organization.management.core.version.range}", + org.wso2.carbon.identity.handler.event.account.lock.*; + version="${carbon.identity.account.lock.handler.imp.pkg.version.range}", !org.wso2.carbon.identity.scim2.common.internal, diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/internal/SCIMCommonComponent.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/internal/SCIMCommonComponent.java index fe809b672..6c8991f90 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/internal/SCIMCommonComponent.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/internal/SCIMCommonComponent.java @@ -125,6 +125,7 @@ protected void activate(ComponentContext ctx) { AdminAttributeUtil.updateAdminUser(MultitenantConstants.SUPER_TENANT_ID, true); AdminAttributeUtil.updateAdminGroup(MultitenantConstants.SUPER_TENANT_ID); SCIMCommonUtils.updateEveryOneRoleV2MetaData(MultitenantConstants.SUPER_TENANT_ID); + SCIMCommonUtils.updateSystemRoleV2MetaData(MultitenantConstants.SUPER_TENANT_ID); if (logger.isDebugEnabled()) { logger.debug("SCIM Common component activated successfully."); } diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java index bfaa0659b..d1b326ace 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/SCIMCommonUtils.java @@ -33,6 +33,7 @@ import org.wso2.carbon.identity.core.URLBuilderException; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; import org.wso2.carbon.identity.core.util.IdentityUtil; +import org.wso2.carbon.identity.handler.event.account.lock.constants.AccountConstants; import org.wso2.carbon.identity.scim2.common.cache.SCIMCustomAttributeSchemaCache; import org.wso2.carbon.identity.scim2.common.exceptions.IdentitySCIMException; import org.wso2.carbon.identity.scim2.common.group.SCIMGroupHandler; @@ -859,12 +860,29 @@ public static void updateEveryOneRoleV2MetaData(int tenantId) { try { UserStoreManager userStoreManager = (UserStoreManager) SCIMCommonComponentHolder.getRealmService(). getTenantUserRealm(tenantId).getUserStoreManager(); - String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration()); SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(userStoreManager.getTenantId()); String everyoneRoleName = userStoreManager.getRealmConfiguration().getEveryOneRoleName(); - String everyoneRoleNameWithDomain = - UserCoreUtil.addDomainToName(everyoneRoleName, domainName); - scimGroupHandler.addRoleV2MandatoryAttributes(everyoneRoleNameWithDomain); + scimGroupHandler.addRoleV2MandatoryAttributes(everyoneRoleName); + } catch (org.wso2.carbon.user.api.UserStoreException | IdentitySCIMException e) { + log.error(e); + } + } + } + + /** + * Update system role meta data. + * + * @param tenantId Tenant Id. + */ + public static void updateSystemRoleV2MetaData(int tenantId) { + + // Handle system role creation also here if legacy runtime is disabled. + if (!CarbonConstants.ENABLE_LEGACY_AUTHZ_RUNTIME) { + try { + UserStoreManager userStoreManager = (UserStoreManager) SCIMCommonComponentHolder.getRealmService(). + getTenantUserRealm(tenantId).getUserStoreManager(); + SCIMGroupHandler scimGroupHandler = new SCIMGroupHandler(userStoreManager.getTenantId()); + scimGroupHandler.addRoleV2MandatoryAttributes(AccountConstants.ACCOUNT_LOCK_BYPASS_ROLE); } catch (org.wso2.carbon.user.api.UserStoreException | IdentitySCIMException e) { log.error(e); } diff --git a/pom.xml b/pom.xml index 26c40998a..804dcd341 100644 --- a/pom.xml +++ b/pom.xml @@ -182,6 +182,12 @@ org.wso2.carbon.identity.organization.management.service ${org.wso2.carbon.identity.organization.management.core.version} + + org.wso2.carbon.identity.event.handler.accountlock + org.wso2.carbon.identity.handler.event.account.lock + ${org.wso2.carbon.identity.handler.event.account.lock.version} + provided + org.wso2.carbon.identity.inbound.provisioning.scim2 org.wso2.carbon.identity.scim2.common @@ -280,6 +286,8 @@ 4.0.14 1.0.76 + 1.8.13 + 2.3.1 @@ -310,6 +318,8 @@ [1.0.0, 2.0.0) + [1.1.12, 2.0.0) + 1.7.21 6.9.10