Package org.passay
Class RepeatCharactersRule
- java.lang.Object
-
- org.passay.RepeatCharactersRule
-
- All Implemented Interfaces:
Rule
public class RepeatCharactersRule extends Object implements Rule
Rule for determining if a password contains multiple sequences of repeating characters.For example, the password "11a22b333xyz" will fail validation of this rule with a sequence length of 2 and sequence count of 3, since it contains 3 sequences (or more) of 2 repeating characters (or more).
- Author:
- Amichai Rothman
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SEQUENCE_COUNT
Default number of sequences, value is 1.static int
DEFAULT_SEQUENCE_LENGTH
Default length of sequence, value is 5.static String
ERROR_CODE
Error code for regex validation failures.protected int
sequenceCount
Number of sequences of repeating characters to match.protected int
sequenceLength
Number of repeating characters to match in each sequence.
-
Constructor Summary
Constructors Constructor Description RepeatCharactersRule()
Creates a new repeat characters rule for a single sequence of the default sequence length.RepeatCharactersRule(int sl)
Creates a new repeat characters rule for a single sequence of the given length.RepeatCharactersRule(int sl, int sc)
Creates a new repeat characters rule for the given number of sequences of the given length.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
createRuleResultDetailParameters(List<String> matches)
Creates the parameter data for the rule result detail.RuleResult
validate(PasswordData passwordData)
Validates the supplied password data per the requirements of this rule.
-
-
-
Field Detail
-
ERROR_CODE
public static final String ERROR_CODE
Error code for regex validation failures.- See Also:
- Constant Field Values
-
DEFAULT_SEQUENCE_LENGTH
public static final int DEFAULT_SEQUENCE_LENGTH
Default length of sequence, value is 5.- See Also:
- Constant Field Values
-
DEFAULT_SEQUENCE_COUNT
public static final int DEFAULT_SEQUENCE_COUNT
Default number of sequences, value is 1.- See Also:
- Constant Field Values
-
sequenceLength
protected int sequenceLength
Number of repeating characters to match in each sequence.
-
sequenceCount
protected int sequenceCount
Number of sequences of repeating characters to match.
-
-
Constructor Detail
-
RepeatCharactersRule
public RepeatCharactersRule()
Creates a new repeat characters rule for a single sequence of the default sequence length.
-
RepeatCharactersRule
public RepeatCharactersRule(int sl)
Creates a new repeat characters rule for a single sequence of the given length.- Parameters:
sl
- sequence length
-
RepeatCharactersRule
public RepeatCharactersRule(int sl, int sc)
Creates a new repeat characters rule for the given number of sequences of the given length.- Parameters:
sl
- sequence lengthsc
- sequence count
-
-
Method Detail
-
validate
public RuleResult validate(PasswordData passwordData)
Description copied from interface:Rule
Validates the supplied password data per the requirements of this rule.
-
-