Code example for CallbackHandler

Methods: handle

0
    public boolean login() throws LoginException { 
        Callback[] callbacks = new Callback[1];
 
        callbacks[0] = new CertificateCallback();
        try { 
            callbackHandler.handle(callbacks);
        } catch (IOException ioe) {
            throw new LoginException(ioe.getMessage());
        } catch (UnsupportedCallbackException uce) {
            throw new LoginException(uce.getMessage() + " Unable to obtain client certificates.");
        } 
        certificates = ((CertificateCallback)callbacks[0]).getCertificates();
 
        username = getUserNameForCertificates(certificates);
        if (username == null) {
            throw new FailedLoginException("No user for client certificate: " + getDistinguishedName(certificates));
        } 
 
        groups = getUserGroups(username);