Class SaltedPasswordEncoder
- java.lang.Object
-
- de.hybris.platform.persistence.security.SaltedPasswordEncoder
-
- All Implemented Interfaces:
PasswordEncoder,java.io.Serializable
public class SaltedPasswordEncoder extends java.lang.Object implements PasswordEncoder
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SaltedPasswordEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringcalculateHash(java.lang.String plain)booleancheck(java.lang.String uid, java.lang.String encoded, java.lang.String plain)Checks if theencodedpassword (from the user, from the database) and theplainpassword (from the login screen) matches.java.lang.Stringdecode(java.lang.String encoded)Decode the givenencodedpassword.java.lang.Stringencode(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 bygetSystemSpecificSalt()
The Value for USER_SPECIFIC_SALT will be generated bygenerateUserSpecificSalt(String)
...protected java.lang.StringgenerateUserSpecificSalt(java.lang.String uid)This implementation will still return the assigned user id.java.lang.StringgetAlgorithmn()java.lang.StringgetSalt()Returns the configured SALT (see core-spring-xml).protected java.lang.StringgetSystemSpecificSalt()This implementation will still return the value of the corresponding spring propertyvoidsetAlgorithmn(java.lang.String algorithmn)voidsetSalt(java.lang.String salt)
-
-
-
Method Detail
-
calculateHash
protected java.lang.String calculateHash(java.lang.String plain)
-
encode
public 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 bygetSystemSpecificSalt()
The Value for USER_SPECIFIC_SALT will be generated bygenerateUserSpecificSalt(String)
... and will return the hash of this constructed string.- Specified by:
encodein interfacePasswordEncoder- Parameters:
uid- the user idpassword- the user password- Returns:
- the hashed value of the constructed string expression
- See Also:
SaltedMD5PasswordEncoder,PlainTextPasswordEncoder
-
check
public boolean check(java.lang.String uid, java.lang.String encoded, java.lang.String plain)Description copied from interface:PasswordEncoderChecks if theencodedpassword (from the user, from the database) and theplainpassword (from the login screen) matches.- Specified by:
checkin interfacePasswordEncoder- Parameters:
uid- mostly the user ID and mostly not used. For MD5 used as salt.encoded- the encoded passwordplain- the plain text password- Returns:
trueif they match,falseotherwise.- See Also:
MD5PasswordEncoder
-
decode
public java.lang.String decode(java.lang.String encoded) throws EJBCannotDecodePasswordExceptionDescription copied from interface:PasswordEncoderDecode the givenencodedpassword. Throws exception if this is not possible.- Specified by:
decodein interfacePasswordEncoder- Parameters:
encoded- the encoded password- Returns:
- the decoded password
- Throws:
EJBCannotDecodePasswordException- if the password cannot be decoded. (MD5 passwords cannot be decoded)- See Also:
MD5PasswordEncoder
-
generateUserSpecificSalt
protected java.lang.String generateUserSpecificSalt(java.lang.String uid)
This implementation will still return the assigned user id.- Parameters:
uid- the suer id- Returns:
- uid the user id as assigned
-
getSystemSpecificSalt
protected java.lang.String getSystemSpecificSalt()
This implementation will still return the value of the corresponding spring property- Returns:
- systemSpecificSalt the value of the corresponding spring property
-
getSalt
public java.lang.String getSalt()
Returns the configured SALT (see core-spring-xml).- Returns:
- the configured SALT
-
setSalt
public void setSalt(java.lang.String salt)
-
getAlgorithmn
public java.lang.String getAlgorithmn()
- Returns:
- the algorithmn
-
setAlgorithmn
public void setAlgorithmn(java.lang.String algorithmn)
- Parameters:
algorithmn- the algorithmn to set
-
-