|
|
|
@ -27,6 +27,7 @@ import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
|
|
|
|
import org.mitre.openid.connect.view.HttpCodeView;
|
|
|
|
|
import org.mitre.openid.connect.view.JsonEntityView;
|
|
|
|
|
import org.mitre.openid.connect.view.JsonErrorView;
|
|
|
|
|
import org.mitre.uma.model.Claim;
|
|
|
|
|
import org.mitre.uma.model.ResourceSet;
|
|
|
|
|
import org.mitre.uma.service.ResourceSetService;
|
|
|
|
|
import org.mitre.uma.view.ResourceSetEntityAbbreviatedView;
|
|
|
|
@ -35,18 +36,23 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
|
|
|
|
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
|
|
|
|
import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.util.MimeTypeUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
|
|
|
|
import com.google.common.base.Strings;
|
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
|
|
|
import com.google.gson.JsonElement;
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
|
import com.google.gson.JsonParseException;
|
|
|
|
@ -72,6 +78,11 @@ public class ResourceSetRegistrationEndpoint {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ConfigurationPropertiesBean config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WebResponseExceptionTranslator providerExceptionHandler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JsonParser parser = new JsonParser();
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.POST, produces = MimeTypeUtils.APPLICATION_JSON_VALUE, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
|
|
|
@ -266,4 +277,12 @@ public class ResourceSetRegistrationEndpoint {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ExceptionHandler(OAuth2Exception.class)
|
|
|
|
|
public ResponseEntity<OAuth2Exception> handleException(Exception e) throws Exception {
|
|
|
|
|
logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage());
|
|
|
|
|
return providerExceptionHandler.translate(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|