org.opends.server.extensions
Class RandomPasswordGenerator

java.lang.Object
  extended by org.opends.server.api.PasswordGenerator<RandomPasswordGeneratorCfg>
      extended by org.opends.server.extensions.RandomPasswordGenerator
All Implemented Interfaces:
ConfigurationChangeListener<RandomPasswordGeneratorCfg>

public class RandomPasswordGenerator
extends PasswordGenerator<RandomPasswordGeneratorCfg>
implements ConfigurationChangeListener<RandomPasswordGeneratorCfg>

This class provides an implementation of a Directory Server password generator that will create random passwords based on fixed-length strings built from one or more character sets.


Constructor Summary
RandomPasswordGenerator()
           
 
Method Summary
 ConfigChangeResult applyConfigurationChange(RandomPasswordGeneratorCfg configuration)
          Applies the configuration changes to this change listener.
 void finalizePasswordGenerator()
          Performs any finalization work that may be necessary when this password generator is taken out of service.
 ByteString generatePassword(Entry userEntry)
          Generates a password for the user whose account is contained in the specified entry.
 void initializePasswordGenerator(RandomPasswordGeneratorCfg configuration)
          Initializes this password generator based on the information in the provided configuration entry.
 boolean isConfigurationAcceptable(PasswordGeneratorCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this password generator.
 boolean isConfigurationChangeAcceptable(RandomPasswordGeneratorCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomPasswordGenerator

public RandomPasswordGenerator()
Method Detail

initializePasswordGenerator

public void initializePasswordGenerator(RandomPasswordGeneratorCfg configuration)
                                 throws ConfigException,
                                        InitializationException
Initializes this password generator based on the information in the provided configuration entry.

Specified by:
initializePasswordGenerator in class PasswordGenerator<RandomPasswordGeneratorCfg>
Parameters:
configuration - The configuration to use to initialize this password validator.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

finalizePasswordGenerator

public void finalizePasswordGenerator()
Performs any finalization work that may be necessary when this password generator is taken out of service.

Overrides:
finalizePasswordGenerator in class PasswordGenerator<RandomPasswordGeneratorCfg>

generatePassword

public ByteString generatePassword(Entry userEntry)
                            throws DirectoryException
Generates a password for the user whose account is contained in the specified entry.

Specified by:
generatePassword in class PasswordGenerator<RandomPasswordGeneratorCfg>
Parameters:
userEntry - The entry for the user for whom the password is to be generated.
Returns:
The password that has been generated for the user.
Throws:
DirectoryException - If a problem occurs while attempting to generate the password.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(PasswordGeneratorCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this password generator. It should be possible to call this method on an uninitialized password generator instance in order to determine whether the password generator would be able to use the provided configuration.

Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.

Overrides:
isConfigurationAcceptable in class PasswordGenerator<RandomPasswordGeneratorCfg>
Parameters:
configuration - The password generator 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:
true if the provided configuration is acceptable for this password generator, or false if not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(RandomPasswordGeneratorCfg configuration,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<RandomPasswordGeneratorCfg>
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 true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(RandomPasswordGeneratorCfg configuration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<RandomPasswordGeneratorCfg>
Parameters:
configuration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.