Package org.passay
Class AbstractDictionaryRule
- java.lang.Object
-
- org.passay.AbstractDictionaryRule
-
- All Implemented Interfaces:
Rule
- Direct Known Subclasses:
DictionaryRule
,DictionarySubstringRule
,DigestDictionaryRule
public abstract class AbstractDictionaryRule extends Object implements Rule
Provides common implementation for password dictionary rules.- Author:
- Middleware Services
-
-
Constructor Summary
Constructors Constructor Description AbstractDictionaryRule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
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.Dictionary
getDictionary()
Returns the dictionary used to search for passwords.protected abstract String
getErrorCode(boolean backwards)
Returns the error code for this rule.boolean
isMatchBackwards()
Returns true if the verify method will search the password for dictionary words spelled backwards as well as forwards.void
setDictionary(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()
RuleResult
validate(PasswordData passwordData)
Validates the supplied password data per the requirements of this rule.
-
-
-
Method Detail
-
setDictionary
public void setDictionary(Dictionary dict)
Sets the dictionary used to search for passwords.- Parameters:
dict
- to use for searching
-
getDictionary
public 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)
Description copied from interface:Rule
Validates the supplied password data per the requirements of this rule.
-
createRuleResultDetailParameters
protected Map<String,Object> createRuleResultDetailParameters(String word)
Creates the parameter data for the rule result detail.- Parameters:
word
- matching word- Returns:
- map of parameter name to value
-
getErrorCode
protected abstract String getErrorCode(boolean backwards)
Returns the error code for this rule.- Parameters:
backwards
- whether to return the error code for a backwards match- Returns:
- properties error code
-
doWordSearch
protected abstract String doWordSearch(String text)
Searches the dictionary with the supplied text.- Parameters:
text
- to search dictionary with- Returns:
- matching word
-
-