Code example for PasswordCallback

Methods: setPassword

0
 
        final String pwd = _users.getProperty(principal.getName());
 
        if (pwd != null)
        { 
            callback.setPassword(pwd.toCharArray());
        } 
        else 
        { 
            throw new AccountNotFoundException("No account found for principal " + principal);
        } 
    } 
 
    public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException
    { 
        //fixme this is not correct as toCharArray is not safe based on the type of string. 
        char[] pwd = _users.getProperty(principal).toCharArray();
 
        return compareCharArray(pwd, password);
    }