public class NoSaltedHashService extends Object implements SaltedHashService
SaltedHashService implementation which does not do any hashing at all. It simply returns the plaintext password
from getSaltedHash(String) and tests the string equality of password and saltedHash in
validate(String, String).
This class is intended to be used in tests and maybe also in some real life scenarios where backwards compatibility requires
storing of plaintext passwords.| Constructor and Description |
|---|
NoSaltedHashService() |
| Modifier and Type | Method and Description |
|---|---|
String |
getSaltedHash(String password)
Computes a salted hash of given plaintext password suitable for storing in a database.
|
boolean |
validate(String password,
String saltedHash)
Checks whether given plaintext
password corresponds to the given saltedHash. |
public String getSaltedHash(String password) throws SaltedHashException
SaltedHashServicegetSaltedHash in interface SaltedHashServiceSaltedHashExceptionpublic boolean validate(String password, String saltedHash) throws SaltedHashException
SaltedHashServicepassword corresponds to the given saltedHash.validate in interface SaltedHashServicetrue if the given password matches the given saltedHash; false otherwise.SaltedHashException - if the saltedHash cannot be parsed or if the hashing algorithm is not available.Copyright © 2018 JBoss by Red Hat. All Rights Reserved.