Package org.passay

Class HistoryRule

  • All Implemented Interfaces:
    Rule
    Direct Known Subclasses:
    DigestHistoryRule

    public class HistoryRule
    extends Object
    implements Rule
    Rule for determining if a password matches one of any previous password a user has chosen. If no historical password reference has been set, then passwords will meet this rule. See PasswordData.setPasswordReferences(List).
    Author:
    Middleware Services
    • Field Detail

      • reportAllFailures

        protected boolean reportAllFailures
        Whether to report all history matches or just the first.
    • Constructor Detail

      • HistoryRule

        public HistoryRule()
        Creates a new history rule.
      • HistoryRule

        public HistoryRule​(boolean reportAll)
        Creates a new history rule.
        Parameters:
        reportAll - whether to report all matches or just the first
    • Method Detail

      • 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
      • matches

        protected boolean matches​(String password,
                                  PasswordData.Reference reference)
        Determines whether a password matches an historical password.
        Parameters:
        password - candidate password
        reference - reference password
        Returns:
        true if passwords match, false otherwise.
      • createRuleResultDetailParameters

        protected Map<String,​Object> createRuleResultDetailParameters​(int size)
        Creates the parameter data for the rule result detail.
        Parameters:
        size - of the history list
        Returns:
        map of parameter name to value