| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** The current configuration for this password validator. */ |
| | | private RandomPasswordGeneratorCfg currentConfig; |
| | | |
| | |
| | | /** The total length of the password that will be generated. */ |
| | | private int totalLength; |
| | | |
| | | /** |
| | | * The numbers of characters of each type that should be used to generate the |
| | | * passwords. |
| | | */ |
| | | /** The numbers of characters of each type that should be used to generate the passwords. */ |
| | | private int[] characterCounts; |
| | | |
| | | /** The character sets that should be used to generate the passwords. */ |
| | |
| | | /** The character set format string for this password generator. */ |
| | | private String formatString; |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordGenerator( |
| | | RandomPasswordGeneratorCfg configuration) |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | |
| | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizePasswordGenerator() |
| | | { |
| | | currentConfig.removeRandomChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates a password for the user whose account is contained in the |
| | | * specified entry. |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PasswordGeneratorCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | RandomPasswordGeneratorCfg configuration, |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | try |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then everything looks OK. |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | RandomPasswordGeneratorCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the character sets for use in generating the password. At least one |
| | | // must have been provided. |
| | | SortedSet<String> newEncodedCharacterSets = null; |
| | |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | ArrayList<NamedCharacterSet> newSetList = new ArrayList<>(); |
| | |
| | | ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // If everything looks OK, then apply the changes. |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |