Package org.opends.server.extensions
Class DictionaryPasswordValidator
java.lang.Object
org.opends.server.api.PasswordValidator<DictionaryPasswordValidatorCfg>
org.opends.server.extensions.DictionaryPasswordValidator
- All Implemented Interfaces:
ConfigurationChangeListener<DictionaryPasswordValidatorCfg>
public class DictionaryPasswordValidator
extends PasswordValidator<DictionaryPasswordValidatorCfg>
implements ConfigurationChangeListener<DictionaryPasswordValidatorCfg>
This class provides an OpenDS password validator that may be used to ensure that proposed passwords are not contained
in a specified dictionary.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of this dictionary password validator. -
Method Summary
Modifier and TypeMethodDescriptionapplyConfigurationChange(DictionaryPasswordValidatorCfg configuration) Applies the configuration changes to this change listener.com.forgerock.opendj.ldap.controls.PasswordQualityAdviceResponseControl.CriteriaReturns a password quality criteria corresponding to the type and parameters of this validator for use in aPasswordQualityAdviceResponseControl.voidPerforms any finalization that might be required when this password validator is unloaded.getStreamOfWords(DictionaryPasswordValidatorCfg configuration) Return a stream of words from the dictionary source, in this case a file.voidinitializePasswordValidator(DictionaryPasswordValidatorCfg configuration) Initializes this password validator based on the information in the provided configuration entry.booleanisConfigurationAcceptable(DictionaryPasswordValidatorCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this password validator.booleanisConfigurationChangeAcceptable(DictionaryPasswordValidatorCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.loadDictionary(DictionaryPasswordValidatorCfg configuration) Loads the configured dictionary and returns it as a hash set.booleanpasswordIsAcceptable(ByteString newPassword, Set<ByteString> currentPasswords, Operation operation, Entry userEntry, LocalizableMessageBuilder invalidReason) Indicates whether the provided password is acceptable for use by the specified user.
-
Constructor Details
-
DictionaryPasswordValidator
public DictionaryPasswordValidator()Creates a new instance of this dictionary password validator.
-
-
Method Details
-
initializePasswordValidator
public void initializePasswordValidator(DictionaryPasswordValidatorCfg configuration) throws InitializationException Description copied from class:PasswordValidatorInitializes this password validator based on the information in the provided configuration entry.- Specified by:
initializePasswordValidatorin classPasswordValidator<DictionaryPasswordValidatorCfg>- Parameters:
configuration- The configuration to use to initialize this password validator.- Throws:
InitializationException- If a problem occurs during initialization that is not related to the server configuration.
-
finalizePasswordValidator
public void finalizePasswordValidator()Description copied from class:PasswordValidatorPerforms any finalization that might be required when this password validator is unloaded. No action is taken in the default implementation.- Overrides:
finalizePasswordValidatorin classPasswordValidator<DictionaryPasswordValidatorCfg>
-
passwordIsAcceptable
public boolean passwordIsAcceptable(ByteString newPassword, Set<ByteString> currentPasswords, Operation operation, Entry userEntry, LocalizableMessageBuilder invalidReason) Description copied from class:PasswordValidatorIndicates whether the provided password is acceptable for use by the specified user. If the password is determined to be unacceptable, then a human-readable explanation should be appended to the provided buffer.- Specified by:
passwordIsAcceptablein classPasswordValidator<DictionaryPasswordValidatorCfg>- Parameters:
newPassword- The proposed clear-text password that should be validated.currentPasswords- The set of clear-text current passwords for the user (if available). Note that the current passwords may not always be available, and this may not comprise entire set of passwords currently for the user.operation- The operation that is being used to set the password. It may be an add, a modify, or a password modify operation.userEntry- The entry for the user whose password is being changed.invalidReason- The buffer to which the human-readable explanation should be appended if it is determined that the password is not acceptable.- Returns:
trueif the password is acceptable, orfalseif not.
-
getStreamOfWords
protected Stream<String> getStreamOfWords(DictionaryPasswordValidatorCfg configuration) throws ConfigException, InitializationException Return a stream of words from the dictionary source, in this case a file.- Parameters:
configuration- the configuration for this password validator.- Returns:
- A stream of words.
- Throws:
ConfigException- if the configured file did not exist.InitializationException- if there was a problem reading the file.
-
loadDictionary
protected Set<String> loadDictionary(DictionaryPasswordValidatorCfg configuration) throws InitializationException Loads the configured dictionary and returns it as a hash set.- Parameters:
configuration- the configuration for this password validator.- Returns:
- The hash set containing the loaded dictionary data.
- Throws:
InitializationException- If there was a problem reading the file.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(DictionaryPasswordValidatorCfg configuration, List<LocalizableMessage> unacceptableReasons) Description copied from class:PasswordValidatorIndicates whether the provided configuration is acceptable for this password validator. It should be possible to call this method on an uninitialized password validator instance in order to determine whether the password validator would be able to use the provided configuration.- Overrides:
isConfigurationAcceptablein classPasswordValidator<DictionaryPasswordValidatorCfg>- Parameters:
configuration- The password validator configuration for which to make the determination.unacceptableReasons- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
trueif the provided configuration is acceptable for this password validator, orfalseif not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(DictionaryPasswordValidatorCfg configuration, List<LocalizableMessage> unacceptableReasons) Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<DictionaryPasswordValidatorCfg>- Parameters:
configuration- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<DictionaryPasswordValidatorCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
createPasswordQualityCriteria
public com.forgerock.opendj.ldap.controls.PasswordQualityAdviceResponseControl.Criteria createPasswordQualityCriteria()Description copied from class:PasswordValidatorReturns a password quality criteria corresponding to the type and parameters of this validator for use in aPasswordQualityAdviceResponseControl.- Specified by:
createPasswordQualityCriteriain classPasswordValidator<DictionaryPasswordValidatorCfg>- Returns:
- A password quality criteria corresponding to the type and parameters of this validator.
-