Append userStore domain to claim value
@@ -182,10 +182,11 @@ public class UniqueClaimUserOperationEventListener extends AbstractIdentityUserO
private boolean isClaimDuplicated(String username, String claimUri, String claimValue, String profile,
UserStoreManager userStoreMgr) throws UserStoreException {
- String[] userList = userStoreMgr.getUserList(claimUri, claimValue, profile);
- if (userList.length == 1) {
String domainName = userStoreMgr.getRealmConfiguration().getUserStoreProperty(
UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
+ String claimValueWithDomain = domainName + UserCoreConstants.DOMAIN_SEPARATOR + claimValue;
+ String[] userList = userStoreMgr.getUserList(claimUri, claimValueWithDomain, profile);
+ if (userList.length == 1) {
String usernameWithUserStoreDomain = UserCoreUtil.addDomainToName(username, domainName);
if (usernameWithUserStoreDomain.equalsIgnoreCase(userList[0])) {
return false;
