class X509AuthenticationFilter extends AbstractAuthenticationProcessingFilter {

    @Override
    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) {
        X509Certificate[] certs = (X509Certificate[]) request.getAttribute("client.auth.X509Certificate");
        if (certs != null && certs.length > 0) {
            return this.authenticationProvider.authenticate(new X509AuthenticationToken(certs));
        }
        return null;
    }

    public  X509AuthenticationFilter(String endpoint,
                                    AuthenticationSuccessHandler successHandler,
                                    AuthenticationProvider authenticationProvider);

}