From 4554066af0afc1832399a81598246e8424fa3a1c Mon Sep 17 00:00:00 2001 From: Pasindu Yeshan Date: Fri, 17 Jan 2025 13:44:12 +0530 Subject: [PATCH] Add attribute profiles properties to schema. --- .../scim2/common/impl/SCIMUserManager.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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 0f686bb72..9ef0e53ec 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 @@ -5835,8 +5835,19 @@ private Map getFilteredSchemaAttributes(Map StringUtils.startsWith(entry.getKey(), ClaimConstants.PROFILES_CLAIM_PROPERTY_PREFIX)) + .anyMatch(entry -> { + String[] profilePropertyKeyArray = entry.getKey().split("\\."); + return profilePropertyKeyArray.length == 3 && + StringUtils.endsWith(entry.getKey(), ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY) && + Boolean.parseBoolean(entry.getValue()); + }); + + return Boolean.parseBoolean(globalSupportedByDefault) || profileSpecificSupportedByDefault; } private boolean isUsernameClaim(ExternalClaim scimClaim) { @@ -6041,6 +6052,15 @@ private void populateBasicAttributes(LocalClaim mappedLocalClaim, AbstractAttrib attribute.addAttributeProperty(SHARED_PROFILE_VALUE_RESOLVING_METHOD_PROPERTY, mappedLocalClaim.getClaimProperty(ClaimConstants.SHARED_PROFILE_VALUE_RESOLVING_METHOD)); } + + // Add attribute profile properties. + for (Map.Entry entry: mappedLocalClaim.getClaimProperties().entrySet()) { + String propertyKey = entry.getKey(); + String propertyValue = entry.getValue(); + if (StringUtils.startsWith(propertyKey, ClaimConstants.PROFILES_CLAIM_PROPERTY_PREFIX)) { + attribute.addAttributeProperty(propertyKey, propertyValue); + } + } } }