public interface I_CmsPasswordHandler extends I_CmsConfigurationParameterHandler
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONVERT_DIGEST_ENCODING
Flag for conversion of the password encoding.
|
static java.lang.String |
DIGEST_TYPE_MD5
String to identify the key value for md5 password hashes.
|
static java.lang.String |
DIGEST_TYPE_PLAIN
String to identify the key value for unhashed passwords.
|
static java.lang.String |
DIGEST_TYPE_SCRYPT
String to identify the key value for SCrypt password hashes.
|
static java.lang.String |
DIGEST_TYPE_SHA
String to identify the key value for sha password hashes.
|
static java.lang.String |
DIGEST_TYPE_SSHA
String to identify the key value for sha password hashes with 4 byte salt.
|
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD| Modifier and Type | Method and Description |
|---|---|
boolean |
checkPassword(java.lang.String plainPassword,
java.lang.String digestedPassword,
boolean useFallback)
This method checks if the given plain text password is equal to the given
digested password.
|
java.lang.String |
digest(java.lang.String password)
Creates an OpenCms password digest according to the default setting for method/encodings.
|
java.lang.String |
digest(java.lang.String password,
java.lang.String digestType,
java.lang.String inputEncoding)
Creates an OpenCms password digest.
|
java.lang.String |
getDigestType()
Returns the default digest type.
|
java.lang.String |
getInputEncoding()
Returns the default password encoding.
|
void |
setDigestType(java.lang.String digestType)
Sets the default digest type.
|
void |
setInputEncoding(java.lang.String inputEncoding)
Sets the default input encoding.
|
void |
validatePassword(java.lang.String password)
This method checks if a new password follows the rules for
new passwords, which are defined by a Class configured in
the opencms.properties file.
|
addConfigurationParameter, getConfiguration, initConfigurationstatic final java.lang.String CONVERT_DIGEST_ENCODING
static final java.lang.String DIGEST_TYPE_MD5
static final java.lang.String DIGEST_TYPE_PLAIN
static final java.lang.String DIGEST_TYPE_SHA
static final java.lang.String DIGEST_TYPE_SSHA
static final java.lang.String DIGEST_TYPE_SCRYPT
boolean checkPassword(java.lang.String plainPassword, java.lang.String digestedPassword, boolean useFallback)
Use this to check salted passwords. If the password is salted, it needs to be checked with the salt (and possible other parameters) stored in the digested password. Just digesting the password again and comparing the result to a previous digest won't work because the salt will usually be different.
plainPassword - the plain text password to checkdigestedPassword - the digested password to compare with the plain passworduseFallback - if true, then use a fall back hashing algorithm in case first validation failsfalse if the validation of the password failedjava.lang.String digest(java.lang.String password) throws CmsPasswordEncryptionException
password - the password to encryptCmsPasswordEncryptionException - if something goes wrongjava.lang.String digest(java.lang.String password, java.lang.String digestType, java.lang.String inputEncoding) throws CmsPasswordEncryptionException
password - the password to encryptdigestType - the algorithm used for encryption (i.e. MD5, SHA ...)inputEncoding - the encoding used when converting the password to bytes (i.e. UTF-8)CmsPasswordEncryptionException - if something goes wrongjava.lang.String getDigestType()
java.lang.String getInputEncoding()
void setDigestType(java.lang.String digestType)
digestType - the digest type usedvoid setInputEncoding(java.lang.String inputEncoding)
inputEncoding - the encoding used for translation the password string to bytesvoid validatePassword(java.lang.String password) throws CmsSecurityException
If this method throws no exception the password is valid.
password - the password to checkCmsSecurityException - if validation of the password failed