Code example for CallbackHandler

Methods: handle

0
            PasswordCallback passwordCb = new PasswordCallback("prompt", false);
            // TODO: should not get pwd as a String but as a char array... 
            String pwd = (String) ft.getString("PASSWORD");
            AuthorizeCallback authzCb = new AuthorizeCallback(username, username);
            Callback[] callbacks = new Callback[]{nameCb, passwordCb, authzCb};
            _cbh.handle(callbacks);
            String storedPwd = new String(passwordCb.getPassword());
            if (storedPwd.equals(pwd))
            { 
                _complete = true;
            } 
            if (authzCb.isAuthorized() && _complete)
            { 
                _authorizationId = authzCb.getAuthenticationID();
                return null; 
            } 
            else 
            { 
                throw new SaslException("Authentication failed"); 
            } 
Connect your IDE to all the code out there  Get Codota for Java