Package net.solarnetwork.service
Interface PasswordEncoder
public interface PasswordEncoder
A password encoder API.
Modeled after the Spring Security PasswordEncoder API.
- Since:
- 1.36
- Version:
- 1.0
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptionencode(CharSequence rawPassword) Encode a raw password.booleanisPasswordEncrypted(CharSequence password) Return true if a password is already encrypted or not.booleanmatches(CharSequence rawPassword, String encodedPassword) Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.
-
Method Details
-
isPasswordEncrypted
Return true if a password is already encrypted or not.This assumes the password has been encoded in such a way that it can be recognized as an ecrypted password, for example with a
{SSHA}prefix.- Parameters:
password- the password- Returns:
- true if the password appears to be in an encrypted form supported by this encoder
-
encode
Encode a raw password.- Parameters:
rawPassword- the password- Returns:
- the encrypted password string
-
matches
Verify 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.- 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
-