Class JBCryptPasswordEncoder
java.lang.Object
org.pac4j.core.credentials.password.JBCryptPasswordEncoder
- All Implemented Interfaces:
PasswordEncoder
A password encoder for bcrypt and using a salt.
Add the
jBcrypt dependency to use this class.- Since:
- 1.9.2
- Author:
- Victor Noël
-
Constructor Summary
ConstructorsConstructorDescriptionUse the default salt generated byBCrypt.gensalt().JBCryptPasswordEncoder(String salt) -
Method Summary
-
Constructor Details
-
JBCryptPasswordEncoder
- Parameters:
salt- the salt to hash with (perhaps generated usingBCrypt.gensalt())- See Also:
-
BCrypt
-
JBCryptPasswordEncoder
public JBCryptPasswordEncoder()Use the default salt generated byBCrypt.gensalt().
-
-
Method Details
-
encode
Description copied from interface:PasswordEncoderEncode a password.- Specified by:
encodein interfacePasswordEncoder- Parameters:
password- the not encoded password- Returns:
- the encoded password
-
matches
Description copied from interface:PasswordEncoderValidate if a plainPassword matches- Specified by:
matchesin interfacePasswordEncoder- Parameters:
plainPassword- the not encoded password to checkencodedPassword- the encoded password- Returns:
trueif they match
-
getSalt
-
setSalt
- Parameters:
salt- the salt to hash with (perhaps generated usingBCrypt.gensalt())- See Also:
-
BCrypt
-