diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java index 1e95b61b2..b76bda76c 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java @@ -950,10 +950,18 @@ private List> transformMembersAttributeToMap(MultiValuedAttr } Map member = new HashMap<>(); - member.put(SCIMConstants.CommonSchemaConstants.VALUE, ((SimpleAttribute) - (subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE))).getStringValue()); - member.put(SCIMConstants.CommonSchemaConstants.DISPLAY, ((SimpleAttribute) - (subAttributesList.get(SCIMConstants.CommonSchemaConstants.DISPLAY))).getStringValue()); + if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE) && + !subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.DISPLAY)) { + throw new CharonException("Either value or display attribute is required for members attribute"); + } + if (subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.DISPLAY)) { + member.put(SCIMConstants.CommonSchemaConstants.DISPLAY, ((SimpleAttribute) + (subAttributesList.get(SCIMConstants.CommonSchemaConstants.DISPLAY))).getStringValue()); + } + if (subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE)) { + member.put(SCIMConstants.CommonSchemaConstants.VALUE, ((SimpleAttribute) + (subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE))).getStringValue()); + } memberList.add(member); } return memberList;