edu.vt.middleware.password
Class UsernameRule

java.lang.Object
  extended by edu.vt.middleware.password.UsernameRule
All Implemented Interfaces:
Rule

public class UsernameRule
extends java.lang.Object
implements Rule

Rule for determining if a password contains the username associated with that password.

Version:
$Revision: 1930 $ $Date: 2011-04-28 13:06:17 -0400 (Thu, 28 Apr 2011) $
Author:
Middleware Services

Field Summary
static java.lang.String ERROR_CODE
          Error code for matching username.
static java.lang.String ERROR_CODE_REVERSED
          Error code for matching reversed dictionary word.
 
Constructor Summary
UsernameRule()
          Default constructor.
UsernameRule(boolean mb, boolean ic)
          Create a new username rule.
 
Method Summary
protected  java.util.Map<java.lang.String,?> createRuleResultDetailParameters(java.lang.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.
 java.lang.String toString()
          Returns a string representation of this object.
 RuleResult validate(PasswordData passwordData)
          Validates the supplied password data per the requirements of this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_CODE

public static final java.lang.String ERROR_CODE
Error code for matching username.

See Also:
Constant Field Values

ERROR_CODE_REVERSED

public static final java.lang.String ERROR_CODE_REVERSED
Error code for matching reversed dictionary word.

See Also:
Constant Field Values
Constructor Detail

UsernameRule

public UsernameRule()
Default constructor.


UsernameRule

public UsernameRule(boolean mb,
                    boolean ic)
Create a new username rule.

Parameters:
mb - whether to match backwards
ic - whether to ignore case
Method Detail

setMatchBackwards

public void setMatchBackwards(boolean b)
Sets whether the verify method will search the password for the username spelled backwards as well as forwards.

Parameters:
b - whether to match username backwards

isMatchBackwards

public boolean isMatchBackwards()
Returns whether to match the username backwards.

Returns:
whether to match username backwards

setIgnoreCase

public void setIgnoreCase(boolean b)
Sets whether the verify method will ignore case when searching the for a username.

Parameters:
b - whether to ignore case

isIgnoreCase

public boolean isIgnoreCase()
Returns whether to ignore the case of the username.

Returns:
whether to ignore case

validate

public RuleResult validate(PasswordData passwordData)
Validates the supplied password data per the requirements of this rule.

Specified by:
validate in interface Rule
Parameters:
passwordData - to verify (not null).
Returns:
details on password verification

createRuleResultDetailParameters

protected java.util.Map<java.lang.String,?> createRuleResultDetailParameters(java.lang.String username)
Creates the parameter data for the rule result detail.

Parameters:
username - matching username
Returns:
map of parameter name to value

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
string representation


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.