Class GenericSaltedPasswordEncoder
- java.lang.Object
-
- de.hybris.platform.persistence.security.GenericSaltedPasswordEncoder
-
- All Implemented Interfaces:
PasswordEncoder,java.io.Serializable
public class GenericSaltedPasswordEncoder extends java.lang.Object implements PasswordEncoder
Generic password encoder that can be parametrized withSaltEncodingPolicyand digest algorithm name. Algorithm name must be supported byMessageDigest- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericSaltedPasswordEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck(java.lang.String uid, java.lang.String encoded, java.lang.String password)Calculates the hash of 'plain' and compare it with the value of 'encoded'.java.lang.Stringdecode(java.lang.String encoded)Decode the givenencodedpassword.java.lang.Stringencode(java.lang.String uid, java.lang.String password)This method add salt to the password and then calculates digestjava.lang.StringgetAlgorithm()voidsetAlgorithm(java.lang.String algorithm)SetsMessageDigestalgorithm used by this beanvoidsetSaltEncodingPolicy(SaltEncodingPolicy saltEncodingPolicy)
-
-
-
Method Detail
-
encode
public java.lang.String encode(java.lang.String uid, java.lang.String password)This method add salt to the password and then calculates digest- Specified by:
encodein interfacePasswordEncoder- Parameters:
uid- the user idpassword- the user password- Returns:
- the hashed value of the salted password
- See Also:
SaltedMD5PasswordEncoder,PlainTextPasswordEncoder
-
check
public boolean check(java.lang.String uid, java.lang.String encoded, java.lang.String password)Calculates the hash of 'plain' and compare it with the value of 'encoded'.- Specified by:
checkin interfacePasswordEncoder- Parameters:
uid- the user idencoded- could be 'null'password- could be 'null'- Returns:
- true if hash of 'plain' is equals to 'encoded'
- See Also:
MD5PasswordEncoder
-
decode
public final 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
-
getAlgorithm
public java.lang.String getAlgorithm()
-
setAlgorithm
public void setAlgorithm(java.lang.String algorithm)
SetsMessageDigestalgorithm used by this bean- Parameters:
algorithm- message digest algorithm
-
setSaltEncodingPolicy
public void setSaltEncodingPolicy(SaltEncodingPolicy saltEncodingPolicy)
-
-