@Test public void shouldReturnForbidden() throws Exception { JwtAccessDeniedHandler handler = new JwtAccessDeniedHandler(); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); AccessDeniedException exception = new AccessDeniedException("Forbidden"); handler.handle(request, response, exception); verify(response).addHeader( "WWW-Authenticate", "Bearer error=\"Insufficient scope\"" ); verify(response).sendError(403, "Forbidden"); }
@Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Insufficient scope\""); super.handle(request, response, accessDeniedException); }
JwtAccessDeniedHandler extends AccessDeniedHandlerImpl { @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Insufficient scope\""); super.handle(request, response, accessDeniedException); } }
JwtAccessDeniedHandler extends AccessDeniedHandlerImpl { @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Insufficient scope\""); super.handle(request, response, accessDeniedException); }  }
JwtAccessDeniedHandler extends AccessDeniedHandlerImpl { @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Insufficient scope\""); super.handle(request, response, accessDeniedException); }  @Override void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException); }
JwtAccessDeniedHandler extends AccessDeniedHandlerImpl { @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Insufficient scope\""); super.handle(request, response, accessDeniedException); }  @Override void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException);  }