Skip to content

Commit

Permalink
Fix idp domain being dropped when checking for existing user.
Browse files Browse the repository at this point in the history
  • Loading branch information
RushanNanayakkara committed Feb 8, 2024
1 parent 2087dc9 commit 085ab15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public class IdentityRecoveryConstants {
public static final String VERIFIED_USER_PROPERTY_KEY = "verifiedUser";
public static final String MANAGE_NOTIFICATIONS_INTERNALLY_PROPERTY_KEY = "manageNotificationsInternally";
public static final String CONFIRMATION_CODE_SEPARATOR = ".";
public static final String TENANT_DOMAIN_SEPARATOR = "@";

// Recovery Scenarios.
public static final String USER_NAME_RECOVERY = "UNR";
Expand All @@ -184,6 +185,8 @@ public class IdentityRecoveryConstants {
"SelfRegistration.Notification.Email.ConfirmationCodeTolerancePeriod";
public static final String SELF_SIGN_UP_SMS_CONFIRMATION_CODE_TOLERANCE_PERIOD =
"SelfRegistration.Notification.SMS.ConfirmationCodeTolerancePeriod";
public static final String ALLOW_EMAIL_USERNAME_WHEN_EMAIL_AS_USERNAME_NOT_ENABLED =
"JITProvisioning.AllowEmailUsernameWhenEmailAsUsernameNotEnabled";
public static final int RECOVERY_CONFIRMATION_CODE_DEFAULT_TOLERANCE = 0;
public static final int ASK_PASSWORD_CODE_DEFAULT_TOLERANCE = 0;
public static final int SELF_SIGN_UP_CODE_DEFAULT_TOLERANCE = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1289,11 +1289,9 @@ public boolean isUsernameAlreadyTaken(String username, String tenantDomain) thro
tenantDomain = MultitenantUtils.getTenantDomain(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) {
Expand Down

0 comments on commit 085ab15

Please sign in to comment.