@Test public void createToken_should_create_token() throws Exception { X509Certificate certificate = mock(X509Certificate.class); ServletRequest request = mock(ServletRequest.class); ServletResponse response = mock(ServletResponse.class); when(request.getAttribute("javax.servlet.request.X509Certificate")).thenReturn( new X509Certificate[]{certificate}); AuthenticationToken token = underTest.createToken(request, response); assertThat(token).isInstanceOf(AuthenticationTokenWrapper.class); AuthenticationTokenWrapper w = (AuthenticationTokenWrapper) token; assertThat(w.getSeedToken()).isInstanceOf(X509CertificateToken.class); X509CertificateToken x = (X509CertificateToken) w.getSeedToken(); assertThat(x.getAuthenticatingCertificates()).containsExactly(certificate); }
@Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { X509Certificate[] certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate"); if (certificates == null) { certificates = new X509Certificate[0]; } return new AuthenticationTokenWrapper(new X509CertificateToken(certificates)); }
X509CertificateFilter extends AuthenticatingFilter { @Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { X509Certificate[] certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate"); if (certificates == null) { certificates = new X509Certificate[0]; } return new AuthenticationTokenWrapper(new X509CertificateToken(certificates)); } }
X509CertificateFilter extends AuthenticatingFilter { @Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { X509Certificate[] certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate"); if (certificates == null) { certificates = new X509Certificate[0]; } return new AuthenticationTokenWrapper(new X509CertificateToken(certificates)); }  }
X509CertificateFilter extends AuthenticatingFilter { @Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { X509Certificate[] certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate"); if (certificates == null) { certificates = new X509Certificate[0]; } return new AuthenticationTokenWrapper(new X509CertificateToken(certificates)); }   }
X509CertificateFilter extends AuthenticatingFilter { @Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { X509Certificate[] certificates = (X509Certificate[]) request.getAttribute( "javax.servlet.request.X509Certificate"); if (certificates == null) { certificates = new X509Certificate[0]; } return new AuthenticationTokenWrapper(new X509CertificateToken(certificates)); }    }