Package org.passay.rule
Class IllegalCharacterRule
java.lang.Object
org.passay.rule.IllegalCharacterRule
- All Implemented Interfaces:
Rule
Rule for determining if a password contains an illegal character. Validation will fail if the password contains any
of the illegal characters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringError code for illegal character failures.private final int[]Stores the character code points that are not allowed.private final MatchBehaviorWhere to match whitespace.protected final booleanWhether to report all sequence matches or just the first. -
Constructor Summary
ConstructorsConstructorDescriptionIllegalCharacterRule(UnicodeString unicodeString) Create a new illegal character rule.IllegalCharacterRule(UnicodeString unicodeString, boolean reportAll) Create a new illegal character rule.IllegalCharacterRule(UnicodeString unicodeString, MatchBehavior behavior) Create a new illegal character rule.IllegalCharacterRule(UnicodeString unicodeString, MatchBehavior behavior, boolean reportAll) Create a new illegal character rule. -
Method Summary
Modifier and TypeMethodDescriptioncreateRuleResultDetailParameters(int codePoint) Creates the parameter data for the rule result detail.protected RuleResultMetadatacreateRuleResultMetadata(PasswordData password) Creates the rule result metadata.Returns the illegal character code points 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 illegal character failures.- See Also:
-
reportAllFailures
protected final boolean reportAllFailuresWhether to report all sequence matches or just the first. -
illegalCharacters
private final int[] illegalCharactersStores the character code points that are not allowed. -
matchBehavior
Where to match whitespace.
-
-
Constructor Details
-
IllegalCharacterRule
Create a new illegal character rule.- Parameters:
unicodeString- illegal character code points
-
IllegalCharacterRule
Create a new illegal character rule.- Parameters:
unicodeString- illegal character code pointsbehavior- how to match illegal characters
-
IllegalCharacterRule
Create a new illegal character rule.- Parameters:
unicodeString- illegal character code pointsreportAll- whether to report all matches or just the first
-
IllegalCharacterRule
Create a new illegal character rule.- Parameters:
unicodeString- illegal character code pointsbehavior- how to match illegal 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
-
getIllegalCharacters
Returns the illegal character code points for this rule.- Returns:
- illegal 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:
codePoint- 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
-