public interface PasswordEncoder
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecodePassword(String encodedPassword)
Returns true if the encodedPassword is in the right format for decoding and
verification by this implementation, otherwise false.
|
String |
encodePassword(String rawPassword)
Encodes a password and returns it as a String suitable for storage by the client.
|
boolean |
isValidPassword(String rawPassword,
String encodedPassword)
Returns true if the rawPassword matches the stored password hash in
encodedPassword, otherwise false.
|
String encodePassword(String rawPassword) throws IllegalArgumentException
Implementations must perform a one-way hashing operation on the rawPassword so that the rawPassword cannot practically be derived from the encoded result by an attacker.
It is recommended that implementations include a unique prefix in their encoded form
which will allow canDecodePassword(String) to be implemented easily.
rawPassword - the password provided by the userIllegalArgumentException - if the rawPassword is null or emptyboolean isValidPassword(String rawPassword, String encodedPassword) throws IllegalArgumentException
encodePassword(String). If the encoded password
is not in a format which is handled by this encoder, this method will return false.
If multiple encodings are supported by an application, the client should call
canDecodePassword(String) to check that the password was generated by
this encoder before calling this method.
rawPassword - the raw password provided by the user for authenticationencodedPassword - the stored password associated with the userIllegalArgumentException - if either rawPassword or encodedPassword is null or emptyboolean canDecodePassword(String encodedPassword)
encodedPassword - the stored password associated with this userCopyright © 2016 Atlassian. All rights reserved.