org.opends.server.api
Class PasswordGenerator<T extends PasswordGeneratorCfg>

java.lang.Object
  extended by org.opends.server.api.PasswordGenerator<T>
Type Parameters:
T - The type of configuration handled by this password generator.
Direct Known Subclasses:
RandomPasswordGenerator

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=true,
           mayInvoke=false)
public abstract class PasswordGenerator<T extends PasswordGeneratorCfg>
extends java.lang.Object

This class defines a set of methods and structures that must be implemented by a Directory Server module that may be used to generate user passwords. The password generator is included as part of a password policy, and is used by the password modify extended operation to construct a new password for the user if that option is chosen.


Constructor Summary
PasswordGenerator()
           
 
Method Summary
 void finalizePasswordGenerator()
          Performs any finalization work that may be necessary when this password generator is taken out of service.
abstract  ByteString generatePassword(Entry userEntry)
          Generates a password for the user whose account is contained in the specified entry.
abstract  void initializePasswordGenerator(T 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordGenerator

public PasswordGenerator()
Method Detail

initializePasswordGenerator

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

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.

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.

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.

finalizePasswordGenerator

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


generatePassword

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

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.