com.ibm.passwordrules

Class LexicalRule

  • java.lang.Object
    • com.ibm.passwordrules.LexicalRule
  • All Implemented Interfaces:
    Rule, java.io.Serializable, java.lang.Cloneable


    public abstract class LexicalRule
    extends java.lang.Object
    implements Rule, java.lang.Cloneable, java.io.Serializable
    Abstract base class for Rule implementations that provide validation of password's lexical content.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DEFAULT_MAX_SEQUENTIAL_CHARACTERS
      Constant for default maximum sequential characters
      static int LOWER_CASE_ONLY
      Constant for specifying that only lower case characters are to be used in password
      static int UPPER_CASE_ONLY
      Constant for specifying that only upper case characters are to be used in password
    • Constructor Summary

      Constructors 
      Constructor and Description
      LexicalRule()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void constrain(PasswordGenerator generator)
      Some Rule implementing classes will not have a constraint to impose, in which case method in this class will be called and will do nothing.
      java.lang.String getParameter()
      This Rule interface method in is not valid in the context of standard rule classes.
      void setParameter(java.lang.String parameter)
      This Rule interface method in is not valid in the context of standard rule classes.
      boolean validateSafe(java.lang.String password, ValidationInfo validationInfo)
      Validate the given password using the given validation info.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_MAX_SEQUENTIAL_CHARACTERS

        public static final int DEFAULT_MAX_SEQUENTIAL_CHARACTERS
        Constant for default maximum sequential characters
        See Also:
        Constant Field Values
      • UPPER_CASE_ONLY

        public static final int UPPER_CASE_ONLY
        Constant for specifying that only upper case characters are to be used in password
        See Also:
        Constant Field Values
      • LOWER_CASE_ONLY

        public static final int LOWER_CASE_ONLY
        Constant for specifying that only lower case characters are to be used in password
        See Also:
        Constant Field Values
    • Constructor Detail

      • LexicalRule

        public LexicalRule()
        Default constructor
    • Method Detail

      • constrain

        public void constrain(PasswordGenerator generator)
        Some Rule implementing classes will not have a constraint to impose, in which case method in this class will be called and will do nothing.
        Specified by:
        constrain in interface Rule
        Parameters:
        generator - including a character template to be constrained.
      • validateSafe

        public boolean validateSafe(java.lang.String password,
                                    ValidationInfo validationInfo)
        Validate the given password using the given validation info. This version should never throw an exception, but will return false if the password is invalid.
        Specified by:
        validateSafe in interface Rule
        Parameters:
        password - Password to validate.
        validationInfo - contains contextual information about the password being validated.
        Returns:
        true if password is valid, false otherwise.
      • getParameter

        public java.lang.String getParameter()
        This Rule interface method in is not valid in the context of standard rule classes. Each standard rule class has its own method for getting constraining parameter value. RuntimeException is thrown during an attempt to use this interface method because the method is not valid in the context of this class.
        Specified by:
        getParameter in interface Rule
        Returns:
        String value of the parameter.
      • setParameter

        public void setParameter(java.lang.String parameter)
        This Rule interface method in is not valid in the context of standard rule classes. Each standard rule class has its own method for setting constraining parameter value. RuntimeException is thrown during an attempt to use this interface method because the method is not valid in the context of this class.
        Specified by:
        setParameter in interface Rule
        Parameters:
        parameter - String value of the parameter.