From 969c336077905696803e7c6b01eac9bd696dce41 Mon Sep 17 00:00:00 2001 From: rushannanayakkara Date: Wed, 7 Feb 2024 15:49:06 +0530 Subject: [PATCH 1/2] Fix idp domain being dropped when checking for existing user. --- .../recovery/signup/UserSelfRegistrationManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java index ea3e1d4987..f6e0d20d5e 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java @@ -1287,13 +1287,13 @@ public boolean isUsernameAlreadyTaken(String username, String tenantDomain) thro if (StringUtils.isBlank(tenantDomain)) { tenantDomain = MultitenantUtils.getTenantDomain(username); + // If tenant domain is not provided, tenant domain is derived from the username. + username = MultitenantUtils.getTenantAwareUsername(username); } try { - String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username); - UserRealm userRealm = getUserRealm(tenantDomain); if (userRealm != null) { - isUsernameAlreadyTaken = userRealm.getUserStoreManager().isExistingUser(tenantAwareUsername) || + isUsernameAlreadyTaken = userRealm.getUserStoreManager().isExistingUser(username) || hasPendingAddUserWorkflow(username, tenantDomain); } } catch (CarbonException | org.wso2.carbon.user.core.UserStoreException e) { From cbeccac2c62f14e0d8bdd326001801a1e81dba2c Mon Sep 17 00:00:00 2001 From: rushannanayakkara Date: Mon, 12 Feb 2024 10:06:49 +0530 Subject: [PATCH 2/2] Fix idp domain being dropped when checking for existing user. --- .../identity/recovery/signup/UserSelfRegistrationManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java index f6e0d20d5e..ec1825784a 100644 --- a/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java +++ b/components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/signup/UserSelfRegistrationManager.java @@ -1287,7 +1287,7 @@ public boolean isUsernameAlreadyTaken(String username, String tenantDomain) thro if (StringUtils.isBlank(tenantDomain)) { tenantDomain = MultitenantUtils.getTenantDomain(username); - // If tenant domain is not provided, tenant domain is derived from the username. + // If tenant domain is not provided, domain from the username is assumed to be the tenant domain. username = MultitenantUtils.getTenantAwareUsername(username); } try {