|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PasswordEncoder
Encodes passwords for storage in an application and allows verification of raw passwords against the stored versions. The actual encoding mechanism depends on the implementation.
for a useful starting point for new implementations
Method Summary | |
---|---|
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. |
Method Detail |
---|
String encodePassword(String rawPassword) throws IllegalArgumentException
canDecodePassword(String)
to be implemented easily.
rawPassword
- the password provided by the user
IllegalArgumentException
- 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 user
IllegalArgumentException
- if either rawPassword or encodedPassword is null or emptyboolean canDecodePassword(String encodedPassword)
encodedPassword
- the stored password associated with this user
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |