class ClientCertAuthenticator extends Authenticator {

    @Override
    public Result authenticate(HttpExchange httpExchange) {
        if( !(httpExchange instanceof HttpsExchange) ) {
            return new Failure(500);
        }
        try {
            HttpsExchange httpsExchange = (HttpsExchange) httpExchange;
            X509Certificate certificate = getClientCert(httpsExchange);
            if (certificate == null) {
                return new Failure(401);
            }
            checkCertForClientUsage(certificate);
            checkCertForAllowedPrincipals(httpsExchange);

            String name="";
            try {
                name = httpsExchange.getSSLSession().getPeerPrincipal().getName();
            } catch (SSLPeerUnverifiedException ignore) {
            }
            return new Success(new HttpPrincipal(name, "ssl"));

        } catch (SecurityException e) {
            return new Failure(403);
        }
    }

    public  ClientCertAuthenticator(JolokiaServerConfig pConfig);

}