From 2a34994383e77fce4296aacfe7a4a46a554a10fc Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Thu, 26 Sep 2013 17:07:38 -0400 Subject: [PATCH] cleanup view --- .../openid/connect/view/UserInfoView.java | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/UserInfoView.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/UserInfoView.java index 99ea8368b..2857d6635 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/UserInfoView.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/UserInfoView.java @@ -31,33 +31,29 @@ import org.springframework.stereotype.Component; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.web.servlet.view.AbstractView; -import com.google.common.base.Strings; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; - @Component("userInfoView") public class UserInfoView extends AbstractView { - + private static JsonParser jsonParser = new JsonParser(); private static Logger logger = LoggerFactory.getLogger(UserInfoView.class); - - private Gson gson = new GsonBuilder() - .setExclusionStrategies(new ExclusionStrategy() { - //@Override + private Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() { + + @Override public boolean shouldSkipField(FieldAttributes f) { return false; } - //@Override + @Override public boolean shouldSkipClass(Class clazz) { // skip the JPA binding wrapper if (clazz.equals(BeanPropertyBindingResult.class)) { @@ -68,8 +64,13 @@ public class UserInfoView extends AbstractView { }).create(); - /* (non-Javadoc) - * @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + /* + * (non-Javadoc) + * + * @see + * org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel + * (java.util.Map, javax.servlet.http.HttpServletRequest, + * javax.servlet.http.HttpServletResponse) */ @Override protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) { @@ -77,21 +78,7 @@ public class UserInfoView extends AbstractView { UserInfo userInfo = (UserInfo) model.get("userInfo"); Set scope = (Set) model.get("scope"); - - String claimsRequestJsonString = (String) model.get("claimsRequest"); - - // getting the 'claims request parameter' from the model - JsonObject claimsRequest = null; - if (!Strings.isNullOrEmpty(claimsRequestJsonString)) { - JsonElement parsed = jsonParser.parse(claimsRequestJsonString); - if (parsed.isJsonObject()) { - claimsRequest = parsed.getAsJsonObject(); - } else { - // claimsRequest stays null - logger.warn("Claims parameter not a valid JSON object: " + claimsRequestJsonString); - } - } - + response.setContentType("application/json"); Writer out;