@Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new Krb5Callback(); try { callbackHandler.handle(callbacks); Principal principal = ((Krb5Callback)callbacks[0]).getPeerPrincipal(); if (principal != null) { principals.add(principal); } } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } if (!principals.isEmpty()) { loginSucceeded = true; } logger.debug("login " + principals); return loginSucceeded; }
if (peerSubject != null) { for (Principal principal : peerSubject.getPrivateCredentials(KerberosPrincipal.class)) { krb5Callback.setPeerPrincipal(principal); return; krb5Callback.setPeerPrincipal(getPeerPrincipalFromConnection(remotingConnection)); } else { throw new UnsupportedCallbackException(callback);
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { ((Krb5Callback) callbacks[0]).setPeerPrincipal(new UserPrincipal("A")); } }, null, null);