|
|
@ -31,16 +31,13 @@ import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.validation.BeanPropertyBindingResult;
|
|
|
|
import org.springframework.validation.BeanPropertyBindingResult;
|
|
|
|
import org.springframework.web.servlet.view.AbstractView;
|
|
|
|
import org.springframework.web.servlet.view.AbstractView;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.base.Strings;
|
|
|
|
|
|
|
|
import com.google.gson.ExclusionStrategy;
|
|
|
|
import com.google.gson.ExclusionStrategy;
|
|
|
|
import com.google.gson.FieldAttributes;
|
|
|
|
import com.google.gson.FieldAttributes;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
import com.google.gson.JsonElement;
|
|
|
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
import com.google.gson.JsonParser;
|
|
|
|
import com.google.gson.JsonParser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component("userInfoView")
|
|
|
|
@Component("userInfoView")
|
|
|
|
public class UserInfoView extends AbstractView {
|
|
|
|
public class UserInfoView extends AbstractView {
|
|
|
|
|
|
|
|
|
|
|
@ -48,16 +45,15 @@ public class UserInfoView extends AbstractView {
|
|
|
|
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(UserInfoView.class);
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(UserInfoView.class);
|
|
|
|
|
|
|
|
|
|
|
|
private Gson gson = new GsonBuilder()
|
|
|
|
private Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {
|
|
|
|
.setExclusionStrategies(new ExclusionStrategy() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@Override
|
|
|
|
@Override
|
|
|
|
public boolean shouldSkipField(FieldAttributes f) {
|
|
|
|
public boolean shouldSkipField(FieldAttributes f) {
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//@Override
|
|
|
|
@Override
|
|
|
|
public boolean shouldSkipClass(Class<?> clazz) {
|
|
|
|
public boolean shouldSkipClass(Class<?> clazz) {
|
|
|
|
// skip the JPA binding wrapper
|
|
|
|
// skip the JPA binding wrapper
|
|
|
|
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
|
|
|
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
|
|
@ -68,8 +64,13 @@ public class UserInfoView extends AbstractView {
|
|
|
|
|
|
|
|
|
|
|
|
}).create();
|
|
|
|
}).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
|
|
|
|
@Override
|
|
|
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
@ -78,20 +79,6 @@ public class UserInfoView extends AbstractView {
|
|
|
|
|
|
|
|
|
|
|
|
Set<String> scope = (Set<String>) model.get("scope");
|
|
|
|
Set<String> scope = (Set<String>) 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");
|
|
|
|
response.setContentType("application/json");
|
|
|
|
|
|
|
|
|
|
|
|
Writer out;
|
|
|
|
Writer out;
|
|
|
|