diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/encoder/JSONDecoder.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/encoder/JSONDecoder.java index 118dbbcbd..98f4269d4 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/encoder/JSONDecoder.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/encoder/JSONDecoder.java @@ -53,6 +53,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -306,6 +307,14 @@ public T decodeResource(String scimResourceString //user may define the attribute by its fully qualified uri attributeValObj = decodedJsonObj.opt(attributeSchema.getURI()); } + if (attributeValObj == null) { + for (Iterator it = decodedJsonObj.keys(); it.hasNext(); ) { + String key = (String) it.next(); + if (key.equalsIgnoreCase(attributeSchema.getName())) { + attributeValObj = decodedJsonObj.get(key); + } + } + } SCIMDefinitions.DataType attributeSchemaDataType = attributeSchema.getType(); if (attributeSchemaDataType.equals(STRING) || attributeSchemaDataType.equals(BINARY) || diff --git a/modules/charon-core/src/test/java/org/wso2/charon3/core/protocol/endpoints/MeResourceManagerTest.java b/modules/charon-core/src/test/java/org/wso2/charon3/core/protocol/endpoints/MeResourceManagerTest.java index c11606783..1fb8f0c97 100644 --- a/modules/charon-core/src/test/java/org/wso2/charon3/core/protocol/endpoints/MeResourceManagerTest.java +++ b/modules/charon-core/src/test/java/org/wso2/charon3/core/protocol/endpoints/MeResourceManagerTest.java @@ -1247,7 +1247,7 @@ public void testGetUserName(Object objectUser, String scimObjectString) public Object[][] dataToTestGetUsernameErrorInGettingTheUsernameFromTheAnonymousRequest() { String scimObjectString = "{\n" + - "UserName: John,\n" + + "InvalidUserName: John,\n" + "}"; return new Object[][]{ {scimObjectString}