Code example for CallbackHandler

Methods: handle

            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};
            String storedPwd = new String(passwordCb.getPassword());
            if (storedPwd.equals(pwd))
                _complete = true;
            if (authzCb.isAuthorized() && _complete)
                _authorizationId = authzCb.getAuthenticationID();
                return null; 
                throw new SaslException("Authentication failed"); 
Connect your IDE to all the code out there  Get Codota for Java