public class PlainTextPasswordAlgorithm extends java.lang.Object implements PasswordAlgorithm
This implementation respects the contract, as the hashPassword method
is a no-op method, we have :
verifyPassword(password, hashPassword(password))
Equivalent to :
verifyPassword(password, password)
Which at its turn is equivalent to :
password.equals(password)
Which is true.
Constructor and Description |
---|
PlainTextPasswordAlgorithm() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
hashPassword(java.lang.String password)
No-op method.
|
boolean |
verifyPassword(java.lang.String plainTextPassword,
java.lang.String hashedPassword)
Checks if the given hashed password is the image of the given plain
text password by the method
PasswordAlgorithm.hashPassword(String) . |
public java.lang.String hashPassword(java.lang.String password)
hashPassword
in interface PasswordAlgorithm
password
- the plain text password to hashpublic boolean verifyPassword(java.lang.String plainTextPassword, java.lang.String hashedPassword)
PasswordAlgorithm
PasswordAlgorithm.hashPassword(String)
.verifyPassword
in interface PasswordAlgorithm
plainTextPassword
- the plain text password to check validity ofhashedPassword
- the hashed password to check plain text password against