edu.vt.middleware.password
Class AbstractDictionaryRule

java.lang.Object
  extended by edu.vt.middleware.password.AbstractDictionaryRule
All Implemented Interfaces:
Rule
Direct Known Subclasses:
DictionaryRule, DictionarySubstringRule

public abstract class AbstractDictionaryRule
extends Object
implements Rule

Provides common implementation for password dictionary rules.

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

Field Summary
protected  edu.vt.middleware.dictionary.Dictionary dictionary
          Dictionary of words.
static String ERROR_CODE
          Error code for matching dictionary word.
static String ERROR_CODE_REVERSED
          Error code for matching reversed dictionary word.
protected  boolean matchBackwards
          Whether to search for dictionary words backwards.
 
Constructor Summary
AbstractDictionaryRule()
           
 
Method Summary
protected  Map<String,?> createRuleResultDetailParameters(String word)
          Creates the parameter data for the rule result detail.
protected abstract  String doWordSearch(String text)
          Searches the dictionary with the supplied text.
 edu.vt.middleware.dictionary.Dictionary getDictionary()
          Returns the dictionary used to search for passwords.
 boolean isMatchBackwards()
          Returns true if the verify method will search the password for dictionary words spelled backwards as well as forwards.
 void setDictionary(edu.vt.middleware.dictionary.Dictionary dict)
          Sets the dictionary used to search for passwords.
 void setMatchBackwards(boolean b)
          This causes the verify method to search the password for dictionary words spelled backwards as well as forwards.
 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 String ERROR_CODE
Error code for matching dictionary word.

See Also:
Constant Field Values

ERROR_CODE_REVERSED

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

See Also:
Constant Field Values

dictionary

protected edu.vt.middleware.dictionary.Dictionary dictionary
Dictionary of words.


matchBackwards

protected boolean matchBackwards
Whether to search for dictionary words backwards.

Constructor Detail

AbstractDictionaryRule

public AbstractDictionaryRule()
Method Detail

setDictionary

public void setDictionary(edu.vt.middleware.dictionary.Dictionary dict)
Sets the dictionary used to search for passwords.

Parameters:
dict - to use for searching

getDictionary

public edu.vt.middleware.dictionary.Dictionary getDictionary()
Returns the dictionary used to search for passwords.

Returns:
dictionary used for searching

setMatchBackwards

public void setMatchBackwards(boolean b)
This causes the verify method to search the password for dictionary words spelled backwards as well as forwards.

Parameters:
b - whether to match dictionary words backwards

isMatchBackwards

public boolean isMatchBackwards()
Returns true if the verify method will search the password for dictionary words spelled backwards as well as forwards.

Returns:
whether to match dictionary words backwards

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 Map<String,?> createRuleResultDetailParameters(String word)
Creates the parameter data for the rule result detail.

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

doWordSearch

protected abstract String doWordSearch(String text)
Searches the dictionary with the supplied text.

Parameters:
text - to search dictionary with
Returns:
matching word

toString

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

Overrides:
toString in class Object
Returns:
string representation


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