SSLSession session = httpsExch.getSSLSession();
if (session != null) {
try {
Principal p = session.getPeerPrincipal();
response = new Success(new HttpPrincipal(p.getName(), realm));
} catch (SSLPeerUnverifiedException e) {
}
}
}
if (response == null) {
response = super.authenticate(httpExchange);
}
if (response instanceof Success) {
// For this method to have been called a Subject with HttpPrincipal was not found within the HttpExchange so now
// create a new one.
HttpPrincipal principal = ((Success) response).getPrincipal();
try {
Collection<Principal> principalCol = new HashSet<Principal>();
principalCol.add(principal);
SubjectUserInfo userInfo = callbackHandler.get().createSubjectUserInfo(principalCol);