@Test public void givenFilterAccessDenied() throws Exception { when(request.getAttribute("javax.servlet.request.X509Certificate")).thenReturn(new X509Certificate[] {cert}); Subject subjectUnderTest = mock(Subject.class); Mockito.doNothing().when(subjectUnderTest).login(any()); setSubject(subjectUnderTest); final X509AuthenticationFilter filter = new X509AuthenticationFilter(); filter.onAccessDenied(request, response); }
@Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { if (!executeLogin(request, response)) { ((HttpServletResponse) response).sendError(403, "Access Denied . Need a valid TLS client certificate"); return false; } return true; }
X509AuthenticationFilter extends AuthenticatingFilter { @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { if (!executeLogin(request, response)) { ((HttpServletResponse) response).sendError(403, "Access Denied . Need a valid TLS client certificate"); return false; } return true; } }
X509AuthenticationFilter extends AuthenticatingFilter { @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { if (!executeLogin(request, response)) { ((HttpServletResponse) response).sendError(403, "Access Denied . Need a valid TLS client certificate"); return false; } return true; }  }
X509AuthenticationFilter extends AuthenticatingFilter { @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { if (!executeLogin(request, response)) { ((HttpServletResponse) response).sendError(403, "Access Denied . Need a valid TLS client certificate"); return false; } return true; }  void setUseHeader(boolean useHeader); }
X509AuthenticationFilter extends AuthenticatingFilter { @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { if (!executeLogin(request, response)) { ((HttpServletResponse) response).sendError(403, "Access Denied . Need a valid TLS client certificate"); return false; } return true; }  void setUseHeader(boolean useHeader);  }