public class BCryptPasswordEncoder extends java.lang.Object implements PasswordEncoder
Modifier and Type | Class and Description |
---|---|
static class |
BCryptPasswordEncoder.BCryptVersion
Stores the default bcrypt version for use in configuration.
|
Constructor and Description |
---|
BCryptPasswordEncoder() |
BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version) |
BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version,
int strength) |
BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version,
int strength,
java.security.SecureRandom random) |
BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version,
java.security.SecureRandom random) |
BCryptPasswordEncoder(int strength) |
BCryptPasswordEncoder(int strength,
java.security.SecureRandom random) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
encode(java.lang.CharSequence rawPassword)
Encode the raw password.
|
boolean |
matches(java.lang.CharSequence rawPassword,
java.lang.String encodedPassword)
Verify the encoded password obtained from storage matches the submitted raw
password after it too is encoded.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
upgradeEncoding
public BCryptPasswordEncoder()
public BCryptPasswordEncoder(int strength)
strength
- the log rounds to use, between 4 and 31public BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version)
version
- the version of bcrypt, can be 2a,2b,2ypublic BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version, java.security.SecureRandom random)
version
- the version of bcrypt, can be 2a,2b,2yrandom
- the secure random instance to usepublic BCryptPasswordEncoder(int strength, java.security.SecureRandom random)
strength
- the log rounds to use, between 4 and 31random
- the secure random instance to usepublic BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version, int strength)
version
- the version of bcrypt, can be 2a,2b,2ystrength
- the log rounds to use, between 4 and 31public BCryptPasswordEncoder(BCryptPasswordEncoder.BCryptVersion version, int strength, java.security.SecureRandom random)
version
- the version of bcrypt, can be 2a,2b,2ystrength
- the log rounds to use, between 4 and 31random
- the secure random instance to usepublic java.lang.String encode(java.lang.CharSequence rawPassword)
PasswordEncoder
encode
in interface PasswordEncoder
public boolean matches(java.lang.CharSequence rawPassword, java.lang.String encodedPassword)
PasswordEncoder
matches
in interface PasswordEncoder
rawPassword
- the raw password to encode and matchencodedPassword
- the encoded password from storage to compare with