Package org.passay
Class DictionaryRule
- java.lang.Object
-
- org.passay.AbstractDictionaryRule
-
- org.passay.DictionaryRule
-
- All Implemented Interfaces:
Rule
public class DictionaryRule extends AbstractDictionaryRule
Rule for determining if a password matches a dictionary word. This rule will optionally also check for reversed words.- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description static String
ERROR_CODE
Error code for matching dictionary word.static String
ERROR_CODE_REVERSED
Error code for matching reversed dictionary word.
-
Constructor Summary
Constructors Constructor Description DictionaryRule()
Creates a new dictionary rule without supplying a dictionary.DictionaryRule(Dictionary dict)
Creates a new dictionary rule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
doWordSearch(String text)
Searches the dictionary with the supplied text.protected String
getErrorCode(boolean backwards)
Returns the error code for this rule.-
Methods inherited from class org.passay.AbstractDictionaryRule
createRuleResultDetailParameters, getDictionary, isMatchBackwards, setDictionary, setMatchBackwards, toString, validate
-
-
-
-
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
-
-
Constructor Detail
-
DictionaryRule
public DictionaryRule()
Creates a new dictionary rule without supplying a dictionary. The dictionary should be set usingAbstractDictionaryRule.setDictionary(Dictionary)
.
-
DictionaryRule
public DictionaryRule(Dictionary dict)
Creates a new dictionary rule. The dictionary should be ready to use when passed to this constructor.- Parameters:
dict
- to use for searching
-
-
Method Detail
-
doWordSearch
protected String doWordSearch(String text)
Description copied from class:AbstractDictionaryRule
Searches the dictionary with the supplied text.- Specified by:
doWordSearch
in classAbstractDictionaryRule
- Parameters:
text
- to search dictionary with- Returns:
- matching word
-
getErrorCode
protected String getErrorCode(boolean backwards)
Description copied from class:AbstractDictionaryRule
Returns the error code for this rule.- Specified by:
getErrorCode
in classAbstractDictionaryRule
- Parameters:
backwards
- whether to return the error code for a backwards match- Returns:
- properties error code
-
-