public class SaltedPasswordEncoder extends Object implements PasswordEncoder
| Constructor and Description |
|---|
SaltedPasswordEncoder() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
calculateHash(String plain) |
boolean |
check(String uid,
String encoded,
String plain)
Checks if the
encoded password (from the user, from the database) and the plain password
(from the login screen) matches. |
String |
decode(String encoded)
Decode the given
encoded password. |
String |
encode(String uid,
String password)
This implementation will build a string with the following pattern
The value for SYSTEM_SPECIFC_SALT will be generated by getSystemSpecificSalt()The Value for USER_SPECIFIC_SALT will be generated by generateUserSpecificSalt(String)... |
protected String |
generateUserSpecificSalt(String uid)
This implementation will still return the assigned user id.
|
String |
getAlgorithmn() |
String |
getSalt()
Returns the configured SALT (see core-spring-xml).
|
protected String |
getSystemSpecificSalt()
This implementation will still return the value of the corresponding spring property
|
void |
setAlgorithmn(String algorithmn) |
void |
setSalt(String salt) |
public String encode(String uid, String password)
getSystemSpecificSalt()generateUserSpecificSalt(String)encode in interface PasswordEncoderuid - the user idpassword - the user passwordSaltedMD5PasswordEncoder,
PlainTextPasswordEncoderpublic boolean check(String uid, String encoded, String plain)
PasswordEncoderencoded password (from the user, from the database) and the plain password
(from the login screen) matches.check in interface PasswordEncoderuid - mostly the user ID and mostly not used. For MD5 used as salt.encoded - the encoded passwordplain - the plain text passwordtrue if they match, false otherwise.MD5PasswordEncoderpublic String decode(String encoded) throws EJBCannotDecodePasswordException
PasswordEncoderencoded password. Throws exception if this is not possible.decode in interface PasswordEncoderencoded - the encoded passwordEJBCannotDecodePasswordException - if the password cannot be decoded. (MD5 passwords cannot be decoded)MD5PasswordEncoderprotected String generateUserSpecificSalt(String uid)
uid - the suer idprotected String getSystemSpecificSalt()
public String getSalt()
public void setSalt(String salt)
public String getAlgorithmn()
public void setAlgorithmn(String algorithmn)
algorithmn - the algorithmn to setCopyright © 2017 SAP SE. All Rights Reserved.