Skip to content

Commit

Permalink
Add the user updated claim list for thread local to be used by downst…
Browse files Browse the repository at this point in the history
…ream tasks
  • Loading branch information
sadilchamishka committed Aug 31, 2024
1 parent a89a8de commit 4b8a887
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5414,15 +5414,22 @@ private void updateUserClaims(User user, Map<String, String> oldClaimList,
}

// Update user claims.
userClaimsToBeModified.putAll(userClaimsToBeAdded);
if (MapUtils.isEmpty(simpleMultiValuedClaimsToBeAdded) &&
MapUtils.isEmpty(simpleMultiValuedClaimsToBeRemoved)) {
// If no multi-valued attribute is modified.
carbonUM.setUserClaimValuesWithID(user.getId(), userClaimsToBeModified, null);
} else {
carbonUM.setUserClaimValuesWithID(user.getId(), convertClaimValuesToList(oldClaimList),
simpleMultiValuedClaimsToBeAdded, simpleMultiValuedClaimsToBeRemoved,
convertClaimValuesToList(userClaimsToBeModified), null);
try {
// The new claim list can be help full for downstream tasks like outbound provisioning.
IdentityUtil.threadLocalProperties.get().put("newClaimList", newClaimList);
userClaimsToBeModified.putAll(userClaimsToBeAdded);
if (MapUtils.isEmpty(simpleMultiValuedClaimsToBeAdded) &&
MapUtils.isEmpty(simpleMultiValuedClaimsToBeRemoved)) {
// If no multi-valued attribute is modified.
carbonUM.setUserClaimValuesWithID(user.getId(), userClaimsToBeModified, null);
} else {
carbonUM.setUserClaimValuesWithID(user.getId(), convertClaimValuesToList(oldClaimList),
simpleMultiValuedClaimsToBeAdded, simpleMultiValuedClaimsToBeRemoved,
convertClaimValuesToList(userClaimsToBeModified), null);
}
}
finally {
IdentityUtil.threadLocalProperties.get().remove("newClaimList");
}
}

Expand Down

0 comments on commit 4b8a887

Please sign in to comment.