fixed json elements of "claims" and "userinfo" being processed out of order.

pull/477/head
William Kim 2013-08-19 14:15:53 -04:00
parent 7b813c79ee
commit b54f33d0db
1 changed files with 5 additions and 5 deletions

View File

@ -208,20 +208,20 @@ public class UserInfoView extends AbstractView {
JsonObject obj = toJson(ui, scope); JsonObject obj = toJson(ui, scope);
//Process list of requested claims out of the request object //Process list of requested claims out of the request object
JsonElement userInfo = requestObj.get("userinfo"); JsonElement claims = requestObj.get("claims");
if (userInfo == null || !userInfo.isJsonObject()) { if (claims == null || !claims.isJsonObject()) {
return obj; return obj;
} }
JsonElement claims = userInfo.getAsJsonObject().get("claims"); JsonElement userinfo = claims.getAsJsonObject().get("userinfo");
if (claims == null || !claims.isJsonObject()) { if (userinfo == null || !userinfo.isJsonObject()) {
return obj; return obj;
} }
// TODO: this method is likely to be fragile if the data model changes at all // TODO: this method is likely to be fragile if the data model changes at all
//For each claim found, add it if not already present //For each claim found, add it if not already present
for (Entry<String, JsonElement> i : claims.getAsJsonObject().entrySet()) { for (Entry<String, JsonElement> i : userinfo.getAsJsonObject().entrySet()) {
String claimName = i.getKey(); String claimName = i.getKey();
if (!obj.has(claimName)) { if (!obj.has(claimName)) {
String value = ""; String value = "";