Package org.passay

Class AbstractDictionaryRule

    • Constructor Detail

      • AbstractDictionaryRule

        public AbstractDictionaryRule()
    • 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.
        Specified by:
        validate in interface Rule
        Parameters:
        passwordData - to verify (not null).
        Returns:
        details on password verification
      • 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