| | |
| | | /** The current dictionary that we should use when performing the validation. */ |
| | | private HashSet<String> dictionary; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this dictionary password validator. |
| | | */ |
| | | /** Creates a new instance of this dictionary password validator. */ |
| | | public DictionaryPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | DictionaryPasswordValidatorCfg configuration) |
| | |
| | | dictionary = loadDictionary(configuration); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeDictionaryChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then the password is acceptable. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Loads the configured dictionary and returns it as a hash set. |
| | | * |
| | |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | |
| | | // Read the contents of file into the dictionary as per the configuration. |
| | | BufferedReader reader = null; |
| | | HashSet<String> dictionary = new HashSet<>(); |
| | |
| | | return dictionary; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DictionaryPasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DictionaryPasswordValidatorCfg configuration) |