-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCS-2420: decode incoming requests independent of case of attribute n… #379
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,10 +51,7 @@ | |
import org.wso2.charon3.core.utils.codeutils.SearchRequest; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; | ||
|
||
import static org.wso2.charon3.core.schema.SCIMDefinitions.DataType.BINARY; | ||
import static org.wso2.charon3.core.schema.SCIMDefinitions.DataType.BOOLEAN; | ||
|
@@ -306,6 +303,15 @@ public <T extends AbstractSCIMObject> T decodeResource(String scimResourceString | |
//user may define the attribute by its fully qualified uri | ||
attributeValObj = decodedJsonObj.opt(attributeSchema.getURI()); | ||
} | ||
if (attributeValObj == null) { | ||
String attributeSchemaName = attributeSchema.getName().toLowerCase(); | ||
for (Iterator it = decodedJsonObj.keys(); it.hasNext(); ) { | ||
String key = (String) it.next(); | ||
if (key.toLowerCase().equals(attributeSchemaName)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could use key.equalsIgnoreCase() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the hint. Changed it accordingly: 58677aa |
||
attributeValObj = decodedJsonObj.get(key); | ||
} | ||
} | ||
} | ||
SCIMDefinitions.DataType attributeSchemaDataType = attributeSchema.getType(); | ||
|
||
if (attributeSchemaDataType.equals(STRING) || attributeSchemaDataType.equals(BINARY) || | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1247,7 +1247,7 @@ public void testGetUserName(Object objectUser, String scimObjectString) | |
public Object[][] dataToTestGetUsernameErrorInGettingTheUsernameFromTheAnonymousRequest() { | ||
|
||
String scimObjectString = "{\n" + | ||
"UserName: John,\n" + | ||
"UsrName: John,\n" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This small change might be hard to notice by people looking at this test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. 58677aa |
||
"}"; | ||
return new Object[][]{ | ||
{scimObjectString} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid * imports.
Import just only the required classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I changed that: f276f89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnuradhaSK am I ready to merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnuradhaSK am I still missing something?