@Test public void onLoginFailure_should_return_false() throws IOException { ServletRequest request = mock(ServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); AuthenticationToken token = mock(AuthenticationToken.class); AuthenticationException ex = mock(AuthenticationException.class); boolean result = underTest.onLoginFailure(token, ex, request, response); assertThat(result).isFalse(); verify(response).sendError(eq(HttpServletResponse.SC_UNAUTHORIZED), anyString()); }
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { if (optional) { return true; } else { WebSecurityPlugin.sendErrorToClient((HttpServletResponse) response, LOGGER, HttpServletResponse.SC_UNAUTHORIZED, "A valid certificate is required to gain access", e); return false; } }
X509CertificateFilter extends AuthenticatingFilter { protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { if (optional) { return true; } else { WebSecurityPlugin.sendErrorToClient((HttpServletResponse) response, LOGGER, HttpServletResponse.SC_UNAUTHORIZED, "A valid certificate is required to gain access", e); return false; } } }
X509CertificateFilter extends AuthenticatingFilter { protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { if (optional) { return true; } else { WebSecurityPlugin.sendErrorToClient((HttpServletResponse) response, LOGGER, HttpServletResponse.SC_UNAUTHORIZED, "A valid certificate is required to gain access", e); return false; } }  }
X509CertificateFilter extends AuthenticatingFilter { protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { if (optional) { return true; } else { WebSecurityPlugin.sendErrorToClient((HttpServletResponse) response, LOGGER, HttpServletResponse.SC_UNAUTHORIZED, "A valid certificate is required to gain access", e); return false; } }   }
X509CertificateFilter extends AuthenticatingFilter { protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { if (optional) { return true; } else { WebSecurityPlugin.sendErrorToClient((HttpServletResponse) response, LOGGER, HttpServletResponse.SC_UNAUTHORIZED, "A valid certificate is required to gain access", e); return false; } }    }