Class SpringPasswordHasher
java.lang.Object
com.irurueta.authserver.authorization.api.web.password.SpringPasswordHasher
- All Implemented Interfaces:
PasswordHasher
Adapter of the
PasswordHasher port over Spring Security's PasswordEncoder.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.crypto.password.PasswordEncoderEncoder that does the work. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencode(CharSequence rawPassword) Encodes a clear-text password (or a client secret) with the current algorithm.booleanmatches(CharSequence rawPassword, String encodedPassword) Checks a clear-text password against an encoded one.booleanupgradeEncoding(String encodedPassword) Tells whether a stored encoding is weaker than the current algorithm and should be replaced the next time the clear-text password is known.
-
Field Details
-
passwordEncoder
private final org.springframework.security.crypto.password.PasswordEncoder passwordEncoderEncoder that does the work.
-
-
Constructor Details
-
SpringPasswordHasher
public SpringPasswordHasher()
-
-
Method Details
-
encode
Description copied from interface:PasswordHasherEncodes a clear-text password (or a client secret) with the current algorithm.- Specified by:
encodein interfacePasswordHasher- Parameters:
rawPassword- the clear-text value.- Returns:
- the encoded value, including its encoding prefix.
-
matches
Description copied from interface:PasswordHasherChecks a clear-text password against an encoded one.- Specified by:
matchesin interfacePasswordHasher- Parameters:
rawPassword- the clear-text value.encodedPassword- the stored encoded value.- Returns:
truewhen they match.
-
upgradeEncoding
Description copied from interface:PasswordHasherTells whether a stored encoding is weaker than the current algorithm and should be replaced the next time the clear-text password is known.- Specified by:
upgradeEncodingin interfacePasswordHasher- Parameters:
encodedPassword- the stored encoded value.- Returns:
truewhen the password should be re-encoded.
-