} else if (credentials instanceof X509Certificate[]) {
X509Certificate[] certs = (X509Certificate[]) credentials;
if (certs.length < 1) {
throw new LoginException("no certificates supplied");
}
callbackHandler = new CertificateCallbackHandler(certs[0]);
} else {
throw new LoginException("Cannot extract credentials from class: " + credentials.getClass().getName());
}
//set up the login context