public interface PasswordEncoderService
passwordEncoding the corresponding PasswordEncoder is used for the encoding/decoding. Use
getSupportedEncodings() to have a look which PasswordEncoders are supported.| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
decode(UserModel user)
Tries to decodes from the given
user the encoded password based on the encoding set to the user. |
java.lang.String |
encode(UserModel user,
java.lang.String plainTextPassword,
java.lang.String passwordEncoding)
Encodes the given
plainTextPassword with the corresponding PasswordEncoder (based on the
passwordEncoding) and returns it. |
java.util.Collection<java.lang.String> |
getSupportedEncodings() |
boolean |
isSupportedEncoding(java.lang.String encoding)
Checks if the given password encoding is supported.
|
boolean |
isValid(UserModel user,
java.lang.String plainPassword)
Checks if the encoded password (stored in the user) matches the given plain text password.
|
java.lang.String encode(UserModel user, java.lang.String plainTextPassword, java.lang.String passwordEncoding) throws PasswordEncoderNotFoundException
plainTextPassword with the corresponding PasswordEncoder (based on the
passwordEncoding) and returns it. The user can be used as 'salt' in the implementation
of the PasswordEncodersuser - can be used as 'salt'. See MD5PasswordEncoderplainTextPassword - the plain passwordpasswordEncoding - based on this encoding the correct PasswordEncoder is usedPasswordEncoderNotFoundException - if for the given passwordEncoding no PasswordEncoder is knownjava.lang.String decode(UserModel user) throws PasswordEncoderNotFoundException, CannotDecodePasswordException
user the encoded password based on the encoding set to the user.
see UserModel.getEncodedPassword() and UserModel.getPasswordEncoding()user - contains the encoded password and the encodingPasswordEncoderNotFoundException - if for the given passwordEncoding no PasswordEncoder is known in the systemCannotDecodePasswordException - if the encoded password cannot be decoded, see MD5PasswordEncoderboolean isSupportedEncoding(java.lang.String encoding)
encoding - the password encodingtrue if the given encoding is supported, false otherwise.PasswordEncoderConstants.DEFAULT_ENCODINGjava.util.Collection<java.lang.String> getSupportedEncodings()
boolean isValid(UserModel user, java.lang.String plainPassword)
user - the user contains the encoded password and the (password) encodingplainPassword - the plain text passwordtrue if the encoded passwords matches, false otherwiseCopyright © 2018 SAP SE. All Rights Reserved.