com.ibm.passwordrules
Interface Rule

All Known Implementing Classes:
BehavioralRule, LexicalRule, RuleSet

public interface Rule

This interface needs to be implemented by all standard and custom password rule classes.


Method Summary
 void constrain(PasswordGenerator generator)
          Constrain the character set in the given password generator to values allowed by the generator.
 java.lang.String getParameter()
          Get the parameter set on a custom rule object.
 boolean join(Rule rule)
          Try to join the specified rule with this one.
 void setParameter(java.lang.String parameter)
          Set the parameter on a custom rule object.
 boolean validate(java.lang.String password, ValidationInfo validationInfo)
          Validate the given password using the given validation info.
 boolean validateSafe(java.lang.String password, ValidationInfo validationInfo)
          Validate the given password using given validation info.
 

Method Detail

validate

public boolean validate(java.lang.String password,
                        ValidationInfo validationInfo)
                 throws InvalidPasswordException
Validate the given password using the given validation info.

Parameters:
password - Password to validate.
validationInfo - contains contextual information about the password being validated.
Returns:
true if password is valid, false otherwise.
Throws:
InvalidPasswordException - thrown when password is invalid.

validateSafe

public boolean validateSafe(java.lang.String password,
                            ValidationInfo validationInfo)
Validate the given password using given validation info. This version should never throw an exception, but will return false if the password is invalid or if it couldn't be validated.

Parameters:
password - Password to validate.
validationInfo - contains contextual information about the password being validated.
Returns:
true if password is valid, false otherwise

constrain

public void constrain(PasswordGenerator generator)
Constrain the character set in the given password generator to values allowed by the generator.

Parameters:
generator - password generator, whose character set will be constrained. NOTE: Constraining a generator only offers a hint. Implementor of a Rule class may choose not to constrain the generator at all, in which case it may take more iterations for the generator to come up with a candidate password compliant with the rule. When constraints are not implemented, IterationsExceededException may be thrown more often from the generate method of the PasswordGenerator. Skipping a constraint should be tested first by attempting to generate a large number of passwords without encountering IterationsExceededException.

join

public boolean join(Rule rule)
             throws IncompatibleRulesException
Try to join the specified rule with this one. The more restrictive rule takes precedence.

Parameters:
rule - - The rule to be joined with this one.
Returns:
true - Returns true, if the specified rule was successfully combined with this one. Returns false, if the specified rule and this one are not of the same class\type or they are not dependent on each other due to which they cannot be combined.
Throws:
IncompatibleRulesException - - Thrown if the specified rule and this one cannot be combined because they are mutually exclusive, i.e. a password cannot satisfy both the rules at the same time. Example if the given rule specifies that the max length of password should be 5, and if this rule specifies that the minimum length of password should be 6, then this function may throw IncompatibleRulesException.

getParameter

public java.lang.String getParameter()
Get the parameter set on a custom rule object.

Returns:
parameter String representing the constraining parameter Null may be returned if the parameter is not required. Parameter value is rule specific and its format may differ from one rule implementation to other. It is up to the rule implementation class to be able to interpret the parameter's meaning.

setParameter

public void setParameter(java.lang.String parameter)
Set the parameter on a custom rule object. The parameter format varies from implementation to implementation.

Parameters:
parameter - String representing the parameter It may be null if the parameter is not required. Parameter value is rule specific and its format may differ from one rule implementation to other. It is up to the rule implementation class to be able to interpret the parameter's meaning.


IBM Tivoli Identity Manager 4.6
© Copyright International Business Machines Corporation 2005. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.