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 45531da5c..469353b2c 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 @@ -932,7 +932,7 @@ private void processValueAttributeOfOperation(SCIMResourceTypeSchema schema, Pat } private List> transformMembersAttributeToMap(MultiValuedAttribute multiValuedMembersAttribute) - throws CharonException { + throws CharonException, BadRequestException { List> memberList = new ArrayList<>(); List subValuesList = multiValuedMembersAttribute.getAttributeValues(); @@ -940,6 +940,22 @@ private List> transformMembersAttributeToMap(MultiValuedAttr ComplexAttribute complexAttribute = (ComplexAttribute) subValue; Map subAttributesList = complexAttribute.getSubAttributesList(); + // Check if `value` (member id) attribute is present and not empty. + if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE)) { + throw new BadRequestException(ResponseCodeConstants.DESC_BAD_REQUEST, + ResponseCodeConstants.INVALID_SYNTAX); + } else if (((SimpleAttribute) + (subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE))).getStringValue().isEmpty()) { + throw new BadRequestException(ResponseCodeConstants.DESC_BAD_REQUEST, + ResponseCodeConstants.INVALID_VALUE); + } + + // Check if `display` value is present. + if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.DISPLAY)) { + throw new BadRequestException(ResponseCodeConstants.DESC_BAD_REQUEST, + ResponseCodeConstants.INVALID_SYNTAX); + } + Map member = new HashMap<>(); member.put(SCIMConstants.CommonSchemaConstants.VALUE, ((SimpleAttribute) (subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE))).getStringValue());