Skip to content

Commit

Permalink
improve logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Thumimku committed Sep 14, 2023
1 parent adbeb88 commit 829d3c7
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,23 @@ private String getTenantAwareUsername(String username) {
username = username.substring(0, username.lastIndexOf('@'));
}
return username;
} else {
return MultitenantUtils.getTenantAwareUsername(username);
}
return MultitenantUtils.getTenantAwareUsername(username);
}

private String getTenantDomain(String username) {

if (isInputValidationEnabled()) {
String tenantDomain = org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
if (!username.contains("@")) {
// Should be super tenant alphanumeric username.
return tenantDomain;
} else {
// If input validation is enabled, email type username should be tenant qualified username.
// Hence sub string after "@" will be tenant domain.
tenantDomain = username.substring(username.lastIndexOf('@') + 1);
return MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
}
return tenantDomain;
} else {
return MultitenantUtils.getTenantDomain(username);
// If input validation is enabled, email type username should be tenant qualified username.
// sub tenant alpha numeric user names also tenant qualified username.
// Hence sub string after "@" will be tenant domain.
return username.substring(username.lastIndexOf('@') + 1);
}
return MultitenantUtils.getTenantDomain(username);
}


Expand Down

0 comments on commit 829d3c7

Please sign in to comment.