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 withSaltEncodingPolicy
and 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 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'.java.lang.String
decode(java.lang.String encoded)
Decode the givenencoded
password.java.lang.String
encode(java.lang.String uid, java.lang.String password)
This method add salt to the password and then calculates digestjava.lang.String
getAlgorithm()
void
setAlgorithm(java.lang.String algorithm)
SetsMessageDigest
algorithm used by this beanvoid
setSaltEncodingPolicy(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:
encode
in 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:
check
in 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 EJBCannotDecodePasswordException
Description copied from interface:PasswordEncoder
Decode the givenencoded
password. Throws exception if this is not possible.- Specified by:
decode
in 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)
SetsMessageDigest
algorithm used by this bean- Parameters:
algorithm
- message digest algorithm
-
setSaltEncodingPolicy
public void setSaltEncodingPolicy(SaltEncodingPolicy saltEncodingPolicy)
-
-