Package org.passay.rule
Class AbstractDictionaryRule
java.lang.Object
org.passay.rule.AbstractDictionaryRule
- All Implemented Interfaces:
Rule
- Direct Known Subclasses:
DictionaryRule,DictionarySubstringRule,DigestDictionaryRule
Provides common implementation for password dictionary rules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DictionaryDictionary of words.private final booleanWhether to search for dictionary words backwards. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDictionaryRule(Dictionary dict, boolean matchBackwards) Creates a new abstract dictionary rule. -
Method Summary
Modifier and TypeMethodDescriptionCreates the parameter data for the rule result detail.protected abstract CharSequencedoWordSearch(UnicodeString text) Searches the dictionary with the supplied text.Returns the dictionary used to search for passwords.protected abstract StringgetErrorCode(boolean backwards) Returns the error code for this rule.booleanReturns true if the verify method will search the password for dictionary words spelled backwards as well as forwards.toString()validate(PasswordData passwordData) Validates the supplied password data per the requirements of this rule.
-
Field Details
-
dictionary
Dictionary of words. -
matchBackwards
private final boolean matchBackwardsWhether to search for dictionary words backwards.
-
-
Constructor Details
-
AbstractDictionaryRule
Creates a new abstract dictionary rule.- Parameters:
dict- to use for searchingmatchBackwards- whether to match dictionary words backwards
-
-
Method Details
-
getDictionary
Returns the dictionary used to search for passwords.- Returns:
- dictionary used for searching
-
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
Description copied from interface:RuleValidates the supplied password data per the requirements of this rule. -
createRuleResultDetailParameters
Creates the parameter data for the rule result detail.- Parameters:
word- matching word- Returns:
- map of parameter name to value
-
getErrorCode
Returns the error code for this rule.- Parameters:
backwards- whether to return the error code for a backwards match- Returns:
- properties error code
-
doWordSearch
Searches the dictionary with the supplied text.- Parameters:
text- to search dictionary with- Returns:
- matching word
-
toString
-