Class PasswordMaker

java.lang.Object
rodeo.password.pgencheck.PasswordMaker

public final class PasswordMaker extends Object
Create passwords according to predefined criteria.

The following criteria are available:

  • length;
  • constraints on characters composing the password:
    • character must belong to a predefined group of characters;
    • minimum and maximum number of characters per group can be specified;
  • the way random numbers are used in password generation can be configured by implementing a RandomUIntGenerator.
  • Method Details

    • factory

      public static PasswordMaker.Factory factory()
      Create a factory to specify password generation criteria and create a PasswordMaker object.
      Returns:
      an internal PasswordMaker factory
      See Also:
    • getLength

      public int getLength()
      Returns the specified length for generated passwords.
      Returns:
      the specified length for generated passwords
    • getRandomUIntGenerator

      public RandomUIntGenerator getRandomUIntGenerator()
      Returns the implementation of the random number generator used to create passwords.
      Returns:
      the implementation of the random number generator used to create passwords
      See Also:
    • create

      public String create()
      Generate a new password.
      Returns:
      the generated password
    • getCharacterGroups

      public List<String> getCharacterGroups()
      Returns a list of the character groups composing the generated passwords.
      Returns:
      the character groups
    • getCharacterGroupCount

      public int getCharacterGroupCount()
      Returns how many character groups are used in composing passwords.
      Returns:
      character group count
    • getCharacterGroup

      public String getCharacterGroup(int index)
      Return the nth character group used in creating passwords. Character groups are referenced in the order they are added to the factory. The first index is 0 (zero).
      Parameters:
      index - of the character group to retrieve
      Returns:
      the character group at the index
      Throws:
      IndexOutOfBoundsException - if the index is invalid
    • getMinCharactersInGroup

      public int getMinCharactersInGroup(int index)
      Return how many characters from the nth character group are required in generated passwords. Character groups are referenced in the order they were added to the factory. The first index is 0 (zero).
      Parameters:
      index - of the character group minimum count to retrieve
      Returns:
      the minimum number of characters from the group at the index required to form a valid password
      Throws:
      IndexOutOfBoundsException - if the index is invalid
    • getMaxCharactersInGroup

      public int getMaxCharactersInGroup(int index)
      Return the maximum number of characters from the nth character group allowed in generated passwords. Character groups are referenced in the order they were added to the factory. The first index is 0 (zero).
      Parameters:
      index - of the character group maximum count to retrieve
      Returns:
      the maximum number of characters from the group at the index allowed in a valid password
      Throws:
      IndexOutOfBoundsException - if the index is invalid
    • getAllChars

      public String getAllChars()
      Return all characters used in generating password.
      Returns:
      characters used in generating password