public class LengthComplexityRule extends Object implements Rule
Modifier and Type | Class and Description |
---|---|
static class |
LengthComplexityRule.Interval
Class that represents an interval of numbers and parses interval notation.
|
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_CODE
Error code for insufficient complexity.
|
static String |
ERROR_CODE_RULES
Error code for missing complexity rules.
|
Constructor and Description |
---|
LengthComplexityRule() |
Modifier and Type | Method and Description |
---|---|
void |
addRules(String interval,
List<Rule> l)
Adds the rules to invoke for the supplied interval.
|
void |
addRules(String interval,
Rule... r)
Adds the rules to invoke for the supplied interval.
|
protected Map<String,Object> |
createRuleResultDetailParameters(int length,
int success,
int ruleCount)
Creates the parameter data for the rule result detail.
|
boolean |
getReportFailure()
Returns whether to add the rule result detail of this rule to the rule result.
|
boolean |
getReportRuleFailures()
Returns whether to add the rule result detail for each rule that fails to validate to the rule result.
|
Map<LengthComplexityRule.Interval,List<? extends Rule>> |
getRules()
Returns the password rules for this complexity rule.
|
void |
setReportFailure(boolean b)
Sets whether to add the rule result detail of this rule to the rule result.
|
void |
setReportRuleFailures(boolean b)
Sets whether to add the rule result detail for each rule that fails to validate to the rule result.
|
String |
toString() |
RuleResult |
validate(PasswordData passwordData)
Validates the supplied password data per the requirements of this rule.
|
public static final String ERROR_CODE
public static final String ERROR_CODE_RULES
public void addRules(String interval, List<Rule> l)
interval
- of integers that the supplied rules apply tol
- list of rulesIllegalArgumentException
- if the supplied rules are empty or null or if interval is invalid or intersects
with an existing intervalpublic void addRules(String interval, Rule... r)
interval
- of integers that the supplied rules apply tor
- list of rulespublic boolean getReportFailure()
public void setReportFailure(boolean b)
b
- whether to add rule result detail of this rulepublic boolean getReportRuleFailures()
public void setReportRuleFailures(boolean b)
b
- whether to add rule result detailspublic Map<LengthComplexityRule.Interval,List<? extends Rule>> getRules()
public RuleResult validate(PasswordData passwordData)
Rule
protected Map<String,Object> createRuleResultDetailParameters(int length, int success, int ruleCount)
length
- of the passwordsuccess
- number of successful rulesruleCount
- number of total rulesCopyright © 2003-2024 Virginia Tech. All Rights Reserved.