Class MessageDigestPasswordEncoder
java.lang.Object
io.gravitee.am.service.authentication.crypto.password.MessageDigestPasswordEncoder
- All Implemented Interfaces:
PasswordEncoder
- Direct Known Subclasses:
MD5PasswordEncoder,SHAPasswordEncoder
- Author:
- Titouan COMPIEGNE (titouan.compiegne at graviteesource.com), GraviteeSource Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencode(CharSequence rawPassword) Encode the raw password.encode(CharSequence rawPassword, byte[] salt) Encode the raw password.booleanmatches(CharSequence rawPassword, String encodedPassword) Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.booleanmatches(CharSequence rawPassword, String encodedPassword, byte[] salt) Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.booleanmatches(CharSequence rawPassword, String encodedPassword, String salt) Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.voidsetAlgorithm(String algorithm) voidsetEncodeSaltAsBase64(boolean encodeSaltAsBase64) voidsetIterationsRounds(int iterationsRounds) voidsetPasswordSaltFormat(String passwordSaltFormat) voidsetSaltLength(int saltLength)
-
Constructor Details
-
MessageDigestPasswordEncoder
-
-
Method Details
-
encode
Description copied from interface:PasswordEncoderEncode the raw password. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.- Specified by:
encodein interfacePasswordEncoder- Parameters:
rawPassword- the raw password to encode
-
encode
Description copied from interface:PasswordEncoderEncode the raw password. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.- Specified by:
encodein interfacePasswordEncoder- Parameters:
rawPassword- the raw password to encodesalt- the salt use to encode the rawPassword
-
matches
Description copied from interface:PasswordEncoderVerify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.- Specified by:
matchesin interfacePasswordEncoder- Parameters:
rawPassword- the raw password to encode and matchencodedPassword- the encoded password from storage to compare with- Returns:
- true if the raw password, after encoding, matches the encoded password from storage
-
matches
Description copied from interface:PasswordEncoderVerify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.- Specified by:
matchesin interfacePasswordEncoder- Parameters:
rawPassword- the raw password to encode and matchencodedPassword- the encoded password from storage to compare withsalt- the salt use to compare the rawPassword and the encodedPassword- Returns:
-
matches
Description copied from interface:PasswordEncoderVerify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.- Specified by:
matchesin interfacePasswordEncoder- Parameters:
rawPassword- the raw password to encode and matchencodedPassword- the encoded password from storage to compare withsalt- the salt use to compare the rawPassword and the encodedPassword- Returns:
-
setAlgorithm
-
setEncodeSaltAsBase64
public void setEncodeSaltAsBase64(boolean encodeSaltAsBase64) -
setSaltLength
public void setSaltLength(int saltLength) -
setPasswordSaltFormat
-
setIterationsRounds
public void setIterationsRounds(int iterationsRounds)
-