public class UsernameRule extends Object implements Rule
PasswordData
returns a null or empty username.Modifier and Type | Field and Description |
---|---|
static String |
ERROR_CODE
Error code for matching username.
|
static String |
ERROR_CODE_REVERSED
Error code for matching reversed dictionary word.
|
Constructor and Description |
---|
UsernameRule()
Default constructor.
|
UsernameRule(boolean mb,
boolean ic)
Create a new username rule.
|
UsernameRule(boolean mb,
boolean ic,
MatchBehavior behavior)
Create a new username rule.
|
UsernameRule(MatchBehavior behavior)
Create a new username rule.
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
createRuleResultDetailParameters(String username)
Creates the parameter data for the rule result detail.
|
boolean |
isIgnoreCase()
Returns whether to ignore the case of the username.
|
boolean |
isMatchBackwards()
Returns whether to match the username backwards.
|
void |
setIgnoreCase(boolean b)
Sets whether the verify method will ignore case when searching the for a username.
|
void |
setMatchBackwards(boolean b)
Sets whether the verify method will search the password for the username spelled backwards as well as forwards.
|
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_REVERSED
public UsernameRule()
public UsernameRule(MatchBehavior behavior)
behavior
- how to match usernamepublic UsernameRule(boolean mb, boolean ic)
mb
- whether to match backwardsic
- whether to ignore casepublic UsernameRule(boolean mb, boolean ic, MatchBehavior behavior)
mb
- whether to match backwardsic
- whether to ignore casebehavior
- how to match usernamepublic void setMatchBackwards(boolean b)
b
- whether to match username backwardspublic boolean isMatchBackwards()
public void setIgnoreCase(boolean b)
b
- whether to ignore casepublic boolean isIgnoreCase()
public RuleResult validate(PasswordData passwordData)
Rule
protected Map<String,Object> createRuleResultDetailParameters(String username)
username
- matching usernameCopyright © 2003-2024 Virginia Tech. All Rights Reserved.