Set<ByteString> currentPasswords,
Operation operation, Entry userEntry,
MessageBuilder invalidReason)
{
// Get a handle to the current configuration.
DictionaryPasswordValidatorCfg config = currentConfig;
HashSet<String> dictionary = this.dictionary;
// Check to see if the provided password is in the dictionary in the order
// that it was provided.
String password = newPassword.toString();
if (! config.isCaseSensitiveValidation())
{
password = toLowerCase(password);
}
if (dictionary.contains(password))
{
invalidReason.append(
ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());
return false;
}
// If we should try the reversed value, then do that as well.
if (config.isTestReversedPassword())
{
if (dictionary.contains(new StringBuilder(password).reverse().toString()))
{
invalidReason.append(
ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());