Class WebMvcErrorHandler

java.lang.Object
nl._42.restsecure.autoconfigure.errorhandling.WebMvcErrorHandler

@RestControllerAdvice @Order(0) public class WebMvcErrorHandler extends Object
Default error handler that handles AccessDeniedException thrown when a method security check fails. Sets the http response status to 401 and returns RFC-7807 json in the body with a custom property: { errorCode: 'SERVER.ACCESS_DENIED_ERROR' } This error handler has an Order annotation set with priority 0 to make sure that it will catch exceptions before any other exception handler with default order does. If you want to handle method security exeptions yourself, you must annotate an errorhandler with Order with priority less than zero .
  • Constructor Details

    • WebMvcErrorHandler

      public WebMvcErrorHandler()
  • Method Details

    • handlesAccessDeniedException

      @ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) public org.springframework.http.ProblemDetail handlesAccessDeniedException(org.springframework.security.access.AccessDeniedException ex)