| | |
| | | /** The current configuration for this password validator. */ |
| | | private CharacterSetPasswordValidatorCfg currentConfig; |
| | | |
| | | /** |
| | | * A mapping between the character sets and the minimum number of characters |
| | | * required for each. |
| | | */ |
| | | /** A mapping between the character sets and the minimum number of characters required for each. */ |
| | | private HashMap<String,Integer> characterSets; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private HashMap<String,Integer> characterRanges; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this character set password validator. |
| | | */ |
| | | /** Creates a new instance of this character set password validator. */ |
| | | public CharacterSetPasswordValidator() |
| | | { |
| | | super(); |
| | |
| | | // performed in the initializePasswordValidator() method. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordValidator( |
| | | CharacterSetPasswordValidatorCfg configuration) |
| | |
| | | processCharacterSetsAndRanges(configuration, true); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordValidator() |
| | | { |
| | | currentConfig.removeCharacterSetChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordIsAcceptable(ByteString newPassword, |
| | | Set<ByteString> currentPasswords, |
| | |
| | | CharacterSetPasswordValidatorCfg config = currentConfig; |
| | | HashMap<String,Integer> characterSets = this.characterSets; |
| | | |
| | | |
| | | // Process the provided password. |
| | | String password = newPassword.toString(); |
| | | HashMap<String,Integer> setCounts = new HashMap<>(); |
| | |
| | | usedOptionalCharacterSets++; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // Check minimum optional character sets are present. |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Parses the provided configuration and extracts the character set |
| | | * definitions and associated minimum counts from them. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CharacterSetPasswordValidatorCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CharacterSetPasswordValidatorCfg configuration) |