From 61fbc3b88873d23b6ae5b3b422dbc8e28f3158b4 Mon Sep 17 00:00:00 2001 From: AnuradhaSK Date: Mon, 27 Jan 2025 00:31:18 +0530 Subject: [PATCH] update claim change addition when old claims don't have value and updated claim set has empty value --- .../carbon/identity/scim2/common/impl/SCIMUserManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java index 773131f1..e675c31a 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java @@ -5508,6 +5508,13 @@ private void updateUserClaims(User user, Map oldClaimList, simpleMultiValuedClaimsToBeAdded.put(key, Arrays.asList(newClaimList.get(key).split(separator))); } } + /* + If the newClaimList has a claim with empty value and the claim is not exist in the oldClaimList, remove that + claim from newClaimList. + */ + newClaimList.entrySet() + .removeIf(entry -> entry.getValue().isEmpty() && !oldClaimList.containsKey(entry.getKey())); + /* Prepare user claims expect multi-valued claims to be added, deleted and modified. Remove simple multi-valued claims URIS from existing claims and updated user's claims.