java.lang.Object
rodeo.password.pgencheck.PasswordMaker
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
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Internal factory to createPasswordMaker
s. -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Generate a new password.static PasswordMaker.Factory
factory()
Create a factory to specify password generation criteria and create aPasswordMaker
object.Return all characters used in generating password.getCharacterGroup
(int index) Return the nth character group used in creating passwords.int
Returns how many character groups are used in composing passwords.Returns a list of the character groups composing the generated passwords.int
Returns the specified length for generated passwords.int
getMaxCharactersInGroup
(int index) Return the maximum number of characters from the nth character group allowed in generated passwords.int
getMinCharactersInGroup
(int index) Return how many characters from the nth character group are required in generated passwords.Returns the implementation of the random number generator used to create passwords.
-
Method Details
-
factory
Create a factory to specify password generation criteria and create aPasswordMaker
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
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
Generate a new password.- Returns:
- the generated password
-
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
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 is0
(zero).- Parameters:
index
- of the character group to retrieve- Returns:
- the character group at the
index
- Throws:
IndexOutOfBoundsException
- if theindex
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 is0
(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 theindex
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 is0
(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 theindex
is invalid
-
getAllChars
Return all characters used in generating password.- Returns:
- characters used in generating password
-