java.lang.Object
rodeo.password.pgencheck.PasswordChecker.Factory
- Enclosing class:
- PasswordChecker
Internal factory to create
PasswordChecker
s.
This factory class allows you to build a PasswordChecker
using a fluent interface. You create a
Factory
by calling PasswordChecker.factory()
.
Once all the criteria have been specified, you call the create
function
to create a PasswordChecker
object.
-
Method Summary
Modifier and TypeMethodDescriptionaddCharGroup
(String charGroup) Add a group of allowed characters in the composition of the password.addCharGroup
(String charGroup, int minCount) Add a group of allowed characters in the composition of the password and specifies a minimum character count.addCharGroup
(String charGroup, int minCount, int maxCount) Add a group of allowed characters in the composition of the password and specifies a minimum and maximum character count.create()
Create aPasswordChecker
according to the specified criteria.disallowDuplicateCharacters
(boolean disallowDuplicateCharacters) Disallow or allow duplicates inside character groups and between character groups.setMinMaxLength
(int minLength, int maxLength) Sets the minimum and maximum password lengths allowed.
-
Method Details
-
setMinMaxLength
Sets the minimum and maximum password lengths allowed.- Parameters:
minLength
- the password minimum lengthmaxLength
- the password maximum length- Returns:
this
factory
-
create
Create aPasswordChecker
according to the specified criteria.- Returns:
- a new
PasswordChecker
matching the specified criteria - Throws:
IllegalStateException
- if no character group has been specifiedIllegalStateException
- if validation would be impossible because the minimum count requirements on character groups would exceed the maximum length allowed for the password
-
addCharGroup
Add a group of allowed characters in the composition of the password.- Parameters:
charGroup
- aString
containing all characters allowed in this group- Returns:
this
factory- Throws:
IllegalArgumentException
- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)
- See Also:
-
addCharGroup
Add a group of allowed characters in the composition of the password and specifies a minimum character count.- Parameters:
charGroup
- aString
containing all characters allowed in this groupminCount
- minimum number of characters from this group that must be present in the password- Returns:
this
factory- Throws:
IllegalArgumentException
- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)
IllegalArgumentException
- ifminCount < 0
- See Also:
-
addCharGroup
Add a group of allowed characters in the composition of the password and specifies a minimum and maximum character count.- Parameters:
charGroup
- aString
containing all characters allowed in this groupminCount
- minimum number of characters from this group that must be present in the passwordmaxCount
- maximum number of characters from this group allowed in the password; a value of0
(zero) means "unlimited" (same as callingaddCharGroup(String, int)
)- Returns:
this
factory- Throws:
IllegalArgumentException
- if the character group contains duplicates or if the character group contains characters already present in other character groups, unless duplicates have been explicitly allowed by callingdisallowDuplicateCharacters(false)
IllegalArgumentException
- ifminCount < 0
, ormaxCount < 0
, ormaxCount < minCount
(unlessmaxCount == 0
)- See Also:
-
disallowDuplicateCharacters
Disallow or allow duplicates inside character groups and between character groups. Allowing duplicate is usually unnecessary and error-prone.- Parameters:
disallowDuplicateCharacters
-true
if duplicate characters should be disallowed (default),false
otherwise- Returns:
this
factory
-