private Result _authenticate(HttpExchange httpExchange) {
Result response = null;
// If we already have a Principal from the SSLSession no need to continue with
// username / password authentication.
if (httpExchange instanceof HttpsExchange) {
HttpsExchange httpsExch = (HttpsExchange) httpExchange;
SSLSession session = httpsExch.getSSLSession();
if (session != null) {
try {
Principal p = session.getPeerPrincipal();
response = new Success(new HttpPrincipal(p.getName(), realmName));