@Test public void testOnAccessDenied() throws IOException { assertFalse(underTest.onAccessDenied(httpServletRequest, httpServletResponse)); verify(httpServletResponse).setStatus(HttpServletResponse.SC_UNAUTHORIZED); verify(httpServletResponse).setContentType("text/plain"); verify(printWriter).print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); }
@Override protected boolean onAccessDenied(final ServletRequest request, final ServletResponse response) throws IOException { log.debug("Rejecting request from {} due to invalid cross-site request forgery token", request.getRemoteAddr()); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); httpResponse.setContentType("text/plain"); httpResponse.getWriter().print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); return false; }
AntiCsrfFilter extends AuthenticationFilter { @Override protected boolean onAccessDenied(final ServletRequest request, final ServletResponse response) throws IOException { log.debug("Rejecting request from {} due to invalid cross-site request forgery token", request.getRemoteAddr()); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); httpResponse.setContentType("text/plain"); httpResponse.getWriter().print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); return false; } }
AntiCsrfFilter extends AuthenticationFilter { @Override protected boolean onAccessDenied(final ServletRequest request, final ServletResponse response) throws IOException { log.debug("Rejecting request from {} due to invalid cross-site request forgery token", request.getRemoteAddr()); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); httpResponse.setContentType("text/plain"); httpResponse.getWriter().print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); return false; } @Inject  AntiCsrfFilter(final AntiCsrfHelper csrfHelper); }
AntiCsrfFilter extends AuthenticationFilter { @Override protected boolean onAccessDenied(final ServletRequest request, final ServletResponse response) throws IOException { log.debug("Rejecting request from {} due to invalid cross-site request forgery token", request.getRemoteAddr()); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); httpResponse.setContentType("text/plain"); httpResponse.getWriter().print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); return false; } @Inject  AntiCsrfFilter(final AntiCsrfHelper csrfHelper); @Override boolean isEnabled(); }
AntiCsrfFilter extends AuthenticationFilter { @Override protected boolean onAccessDenied(final ServletRequest request, final ServletResponse response) throws IOException { log.debug("Rejecting request from {} due to invalid cross-site request forgery token", request.getRemoteAddr()); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); httpResponse.setContentType("text/plain"); httpResponse.getWriter().print(AntiCsrfHelper.ERROR_MESSAGE_TOKEN_MISMATCH); return false; } @Inject  AntiCsrfFilter(final AntiCsrfHelper csrfHelper); @Override boolean isEnabled(); static final String NAME; }