com.ibm.passwordrules

Interface PasswordGenerator



  • public interface PasswordGenerator
    Interface which needs to be implemented by all custom password generators.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int LAST_CHARACTER_INDEX
      Constant used to initialize the maximum password length.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void addAllowedCharSet(java.util.Set<char[]> allowedCharSets, int numOfSets)
      Constrain the sets of characters that the password must include
      void addChars(char[] list)
      Constrain the set of characters to be used by the password generator.
      void allLowerCase()
      Constrain the set of characters to be used by the password generator.
      void allUpperCase()
      Constrain the set of characters to be used by the password generator.
      java.lang.String generate()
      Generate a string containing a password.
      void initialize(java.lang.String parameter)
      Initialize the password generator.
      void removeChars(char[] charList)
      Constrain the set of characters to be used by the password generator.
      void setCharListAt(char[] charList, int startIndex, int endIndex)
      Constrain the set of characters to be used by the password generator.
      void setLength(int length)
      Set the fixed length of passwords to be generated.
    • Field Detail

      • LAST_CHARACTER_INDEX

        static final int LAST_CHARACTER_INDEX
        Constant used to initialize the maximum password length.
        See Also:
        Constant Field Values
    • Method Detail

      • generate

        java.lang.String generate()
        Generate a string containing a password.
        Returns:
        password
      • setLength

        void setLength(int length)
        Set the fixed length of passwords to be generated.
        Parameters:
        length - requested length of password.
      • addChars

        void addChars(char[] list)
        Constrain the set of characters to be used by the password generator.
        Parameters:
        list - of characters of which at least one must be included in the generated password.
      • removeChars

        void removeChars(char[] charList)
        Constrain the set of characters to be used by the password generator.
        Parameters:
        charList - List of characters none of which may be included in the generated password.
      • allUpperCase

        void allUpperCase()
        Constrain the set of characters to be used by the password generator. Method to ensure that all characters in the generated password will be upper case.
      • allLowerCase

        void allLowerCase()
        Constrain the set of characters to be used by the password generator. Method to ensure that all characters in the generated password will be lower case.
      • setCharListAt

        void setCharListAt(char[] charList,
                           int startIndex,
                           int endIndex)
        Constrain the set of characters to be used by the password generator.
        Parameters:
        charList - list of characters to set
        startIndex - start index of the character in the generated password to choose one of the given set of characters from.
        endIndex - last index of the character in the generated password to choose one of the given set of characters from.
      • initialize

        void initialize(java.lang.String parameter)
        Initialize the password generator. Method will be called once immediately after the generator instance is created.
        Parameters:
        parameter - any text data which might be used in initializing the generator
      • addAllowedCharSet

        void addAllowedCharSet(java.util.Set<char[]> allowedCharSets,
                               int numOfSets)
        Constrain the sets of characters that the password must include
        Parameters:
        allowedCharSet - the sets of characters that the password may contain
        satisfiedSet - minimum number of sets from which the password must contain characters