new X509CertificateAuthenticator and some refactoring