added claims gathering URI to "need_info" response
parent
eba7f78cb0
commit
1ec66450e9
|
@ -20,6 +20,7 @@ package org.mitre.uma.web;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
||||||
import org.mitre.openid.connect.view.HttpCodeView;
|
import org.mitre.openid.connect.view.HttpCodeView;
|
||||||
import org.mitre.openid.connect.view.JsonEntityView;
|
import org.mitre.openid.connect.view.JsonEntityView;
|
||||||
import org.mitre.openid.connect.view.JsonErrorView;
|
import org.mitre.openid.connect.view.JsonErrorView;
|
||||||
|
@ -27,6 +28,7 @@ import org.mitre.uma.exception.InvalidTicketException;
|
||||||
import org.mitre.uma.exception.NeedInfoException;
|
import org.mitre.uma.exception.NeedInfoException;
|
||||||
import org.mitre.uma.exception.NotAuthorizedException;
|
import org.mitre.uma.exception.NotAuthorizedException;
|
||||||
import org.mitre.uma.model.Claim;
|
import org.mitre.uma.model.Claim;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
@ -43,6 +45,9 @@ import com.google.gson.JsonPrimitive;
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class UmaExceptionHandler {
|
public class UmaExceptionHandler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
@ExceptionHandler(NeedInfoException.class)
|
@ExceptionHandler(NeedInfoException.class)
|
||||||
public ModelAndView handleUmaException(Exception e) {
|
public ModelAndView handleUmaException(Exception e) {
|
||||||
// if we got here, the claim didn't match, forward the user to the claim gathering endpoint
|
// if we got here, the claim didn't match, forward the user to the claim gathering endpoint
|
||||||
|
@ -78,6 +83,7 @@ public class UmaExceptionHandler {
|
||||||
rpClaims.add("required_claims", req);
|
rpClaims.add("required_claims", req);
|
||||||
details.add("requesting_party_claims", rpClaims);
|
details.add("requesting_party_claims", rpClaims);
|
||||||
entity.add("error_details", details);
|
entity.add("error_details", details);
|
||||||
|
entity.addProperty("claims_endpoint", config.getIssuer() + ClaimsCollectionEndpoint.URL);
|
||||||
|
|
||||||
Map<String, Object> m = new HashMap<>();
|
Map<String, Object> m = new HashMap<>();
|
||||||
m.put(JsonEntityView.ENTITY, entity);
|
m.put(JsonEntityView.ENTITY, entity);
|
||||||
|
|
Loading…
Reference in New Issue