Spring MVC Access to Spring Security ConfigAttributes?

I want to create an HTTP Response Body with an error message referencing something like _ "missing ..." CUSTOM_AUTHORITY '"_ in addition to the HTTP 403 Forbidden status code.

My Spring application Download using the Spring -Security-Secured @PreAuthorize in Spring -MVC-REST @Controller :

Mycontroller

 @Controller @RequestMapping("/foo") public FooController{ @PreAuthorize("hasAuthority('CUSTOM_AUTHORITY')") public Object getSomething(){ ... } } 

GlobalExceptionHandlerResolver

 @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) public Object forbidden(AccessDeniedException exception){ ... } } 

I want to show / insert Collection<ConfigAttribute> . Spring Security Documents reference it .

+5
source share

All Articles