public class SaltedPasswordEncoder extends java.lang.Object implements PasswordEncoder
| Constructor and Description |
|---|
SaltedPasswordEncoder() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
calculateHash(java.lang.String plain) |
boolean |
check(java.lang.String uid,
java.lang.String encoded,
java.lang.String plain)
Checks if the
encoded password (from the user, from the database) and the plain password
(from the login screen) matches. |
java.lang.String |
decode(java.lang.String encoded)
Decode the given
encoded password. |
java.lang.String |
encode(java.lang.String uid,
java.lang.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 java.lang.String |
generateUserSpecificSalt(java.lang.String uid)
This implementation will still return the assigned user id.
|
java.lang.String |
getAlgorithmn() |
java.lang.String |
getSalt()
Returns the configured SALT (see core-spring-xml).
|
protected java.lang.String |
getSystemSpecificSalt()
This implementation will still return the value of the corresponding spring property
|
void |
setAlgorithmn(java.lang.String algorithmn) |
void |
setSalt(java.lang.String salt) |
protected java.lang.String calculateHash(java.lang.String plain)
public java.lang.String encode(java.lang.String uid,
java.lang.String password)
getSystemSpecificSalt()generateUserSpecificSalt(String)encode in interface PasswordEncoderuid - the user idpassword - the user passwordSaltedMD5PasswordEncoder,
PlainTextPasswordEncoderpublic boolean check(java.lang.String uid,
java.lang.String encoded,
java.lang.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 java.lang.String decode(java.lang.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 java.lang.String generateUserSpecificSalt(java.lang.String uid)
uid - the suer idprotected java.lang.String getSystemSpecificSalt()
public java.lang.String getSalt()
public void setSalt(java.lang.String salt)
public java.lang.String getAlgorithmn()
public void setAlgorithmn(java.lang.String algorithmn)
algorithmn - the algorithmn to setCopyright © 2018 SAP SE. All Rights Reserved.