Skip to content

Commit

Permalink
Merge pull request #804 from RushanNanayakkara/fix-jit-username
Browse files Browse the repository at this point in the history
Avoid federated users idp domain being dropped when email as username is not enabled.
  • Loading branch information
RushanNanayakkara authored Feb 12, 2024
2 parents 2087dc9 + cbeccac commit 1c10f6b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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, domain from the username is assumed to be the tenant domain.
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) {
Expand Down

0 comments on commit 1c10f6b

Please sign in to comment.