Code example for PasswordCallback

Methods: getPassword

0
 
    public byte[] evaluateChallenge(byte[] challenge) throws SaslException
    { 
        // we do not care about the prompt or the default name 
        NameCallback nameCallback = new NameCallback("prompt", "defaultName");
        PasswordCallback pwdCallback = new PasswordCallback("prompt", false);
        Callback[] callbacks = new Callback[]{nameCallback, pwdCallback};
        try 
        { 
            _cbh.handle(callbacks);
        } 
        catch (Exception e)
        { 
            throw new SaslException("Error handling SASL callbacks: " + e, e);
        } 
        FieldTable table = FieldTableFactory.newFieldTable();
        table.setString("LOGIN", nameCallback.getName());
        table.setString("PASSWORD", new String(pwdCallback.getPassword()));
        return table.getDataAsBytes();
    } 
 
    public boolean isComplete() 
    {