Package org.passay.rule
Class AllowedCharacterRule
java.lang.Object
org.passay.rule.AllowedCharacterRule
- All Implemented Interfaces:
Rule
Rule for determining if a password contains allowed characters. Validation will fail unless the password contains
only allowed characters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]Stores the character code points that are allowed.static final StringError code for allowed character failures.private final MatchBehaviorWhere to match whitespace.protected final booleanWhether to report all sequence matches or just the first. -
Constructor Summary
ConstructorsConstructorDescriptionAllowedCharacterRule(UnicodeString unicodeString) Create a new allowed character rule.AllowedCharacterRule(UnicodeString unicodeString, boolean reportAll) Create a new allowed character rule.AllowedCharacterRule(UnicodeString unicodeString, MatchBehavior behavior) Create a new allowed character rule.AllowedCharacterRule(UnicodeString unicodeString, MatchBehavior behavior, boolean reportAll) Create a new allowed character rule. -
Method Summary
Modifier and TypeMethodDescriptioncreateRuleResultDetailParameters(int cp) Creates the parameter data for the rule result detail.protected RuleResultMetadatacreateRuleResultMetadata(PasswordData password) Creates the rule result metadata.Returns the allowed characters for this rule.Returns the match behavior for this rule.booleanReturns whether to report all matches or just the first.toString()validate(PasswordData passwordData) Validates the supplied password data per the requirements of this rule.
-
Field Details
-
ERROR_CODE
Error code for allowed character failures.- See Also:
-
reportAllFailures
protected final boolean reportAllFailuresWhether to report all sequence matches or just the first. -
allowedCharacters
private final int[] allowedCharactersStores the character code points that are allowed. -
matchBehavior
Where to match whitespace.
-
-
Constructor Details
-
AllowedCharacterRule
Create a new allowed character rule.- Parameters:
unicodeString- allowed characters
-
AllowedCharacterRule
Create a new allowed character rule.- Parameters:
unicodeString- allowed charactersbehavior- how to match allowed characters
-
AllowedCharacterRule
Create a new allowed character rule.- Parameters:
unicodeString- allowed charactersreportAll- whether to report all matches or just the first
-
AllowedCharacterRule
Create a new allowed character rule.- Parameters:
unicodeString- allowed charactersbehavior- how to match allowed charactersreportAll- whether to report all matches or just the first
-
-
Method Details
-
getReportAllFailures
public boolean getReportAllFailures()Returns whether to report all matches or just the first.- Returns:
- whether to report all matches or just the first
-
getAllowedCharacters
Returns the allowed characters for this rule.- Returns:
- allowed character code points
-
getMatchBehavior
Returns the match behavior for this rule.- Returns:
- match behavior
-
validate
Description copied from interface:RuleValidates the supplied password data per the requirements of this rule. -
createRuleResultDetailParameters
Creates the parameter data for the rule result detail.- Parameters:
cp- illegal character code point- Returns:
- map of parameter name to value
-
createRuleResultMetadata
Creates the rule result metadata.- Parameters:
password- data used for metadata creation- Returns:
- rule result metadata
-
toString
-