Interface PasswordEncoder
public interface PasswordEncoder
Encoder of a password. It implements one of the possible kinds of
PasswordEncoding.
You can use it to encode password for secure storage, and then to check the password against stored encoded password.-
Method Summary
Modifier and TypeMethodDescriptionencodeAsync(String password) Encodes a password.booleanisValidFormat(String encodedPassword) Checks if the encoded password looks like it is valid to be matched with this password encoder.matchAsync(String rawPassword, String encodedPassword) Matches raw password against encoded password.
-
Method Details
-
encodeAsync
Encodes a password. Returns encoded password, which can be safely stored and later matched against raw password with this instance ofPasswordEncoder.- Parameters:
password- raw password to be encoded.- Returns:
- encoded version of a password. It can contain embedded information about encoding itself such as encoding depth, algorithm version and generated salt used to encode a password.
-
matchAsync
Matches raw password against encoded password.- Parameters:
rawPassword- raw password to be matched.encodedPassword- password encoded with the algorithm implemented by thisPasswordEncoder.- Returns:
- Future completed with
trueif raw password matches encoded password.
-
isValidFormat
Checks if the encoded password looks like it is valid to be matched with this password encoder.- Parameters:
encodedPassword- Encoded password to check.- Returns:
- true if this encoded password string seems like validly encoded with the algorithm used by this encoder.
-