/** * As in the above method the user account lock claim, primary challenges claim will be separately * handled. Identity claims will be removed from the claim set before adding claims to the user * store. */ @Override public boolean doPreSetUserClaimValues( String userName, Map<String, String> claims, String profileName, UserStoreManager userStoreManager) throws UserStoreException { IdentityMgtConfig config = IdentityMgtConfig.getInstance(); if (!config.isListenerEnable()) { return true; } UserIdentityDataStore identityDataStore = IdentityMgtConfig.getInstance().getIdentityDataStore(); // To fix https://wso2.org/jira/browse/IDENTITY-1227 UserIdentityClaimsDO identityDTO = new UserIdentityClaimsDO(userName); // identityDTO = identityDataStore.load(userName, userStoreManager); // if (identityDTO == null) { // user doesn't exist in the system // return false; // } // removing identity claims and security questions Iterator<Entry<String, String>> it = claims.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, String> claim = it.next(); if (claim.getKey().contains(UserCoreConstants.ClaimTypeURIs.CHALLENGE_QUESTION_URI) || claim.getKey().contains(UserCoreConstants.ClaimTypeURIs.IDENTITY_CLAIM_URI)) { identityDTO.setUserIdentityDataClaim(claim.getKey(), claim.getValue()); it.remove(); } } // storing the identity claims and security questions try { identityDataStore.store(identityDTO, userStoreManager); } catch (IdentityException e) { throw new UserStoreException("Error while doPreSetUserClaimValues", e); } return true; }