Methods Summary |
---|
protected java.lang.String | getHashAlgorithm()Method to access the hashing algorithm of the password.
return algorithm;
|
protected java.lang.String | getHashedPassword()Method to access hash of password
return hashedPassword;
|
public java.lang.String | getUserName()Accessor for immutable name
return userName;
|
public boolean | setPassword(java.lang.String newPass)Sets new password from String. No checks made on guessability of
password.
try {
hashedPassword = DigestUtil.digestString(newPass, algorithm);
return true;
} catch (NoSuchAlgorithmException nsae) {
throw new RuntimeException("Security error: " + nsae);
}
|
public boolean | verifyPassword(java.lang.String pass)Method to verify passwords.
try {
String hashGuess = DigestUtil.digestString(pass, algorithm);
return hashedPassword.equals(hashGuess);
} catch (NoSuchAlgorithmException nsae) {
throw new RuntimeException("Security error: " + nsae);
}
|