Class IllegalRegexRule

java.lang.Object
org.passay.rule.IllegalRegexRule
All Implemented Interfaces:
Rule

public class IllegalRegexRule extends Object implements Rule
Rule for determining if a password matches an illegal regular expression. Passwords which match the expression will fail validation.
  • Field Details

    • ERROR_CODE

      public static final String ERROR_CODE
      Error code for regex validation failures.
      See Also:
    • pattern

      protected final Pattern pattern
      Regex pattern.
    • reportAllFailures

      protected final boolean reportAllFailures
      Whether to report all regex matches or just the first.
  • Constructor Details

    • IllegalRegexRule

      public IllegalRegexRule(String regex)
      Creates a new illegal regex rule.
      Parameters:
      regex - regular expression
    • IllegalRegexRule

      public IllegalRegexRule(String regex, int regexFlags)
      Creates a new illegal regex rule.
      Parameters:
      regex - regular expression
      regexFlags - regular expression flags
    • IllegalRegexRule

      public IllegalRegexRule(String regex, boolean reportAll)
      Creates a new illegal regex rule.
      Parameters:
      regex - regular expression
      reportAll - whether to report all matches or just the first
    • IllegalRegexRule

      public IllegalRegexRule(String regex, int regexFlags, boolean reportAll)
      Creates a new illegal regex rule.
      Parameters:
      regex - regular expression
      regexFlags - regular expression flags
      reportAll - whether to report all matches or just the first
  • Method Details

    • getReportAllFailures

      public boolean getReportAllFailures()
      Returns whether to report all matches or just the first.
      Returns:
      whether to report all matches or just the first
    • getPattern

      public Pattern getPattern()
      Returns the pattern for this rule.
      Returns:
      pattern
    • 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 match)
      Creates the parameter data for the rule result detail.
      Parameters:
      match - matching regex
      Returns:
      map of parameter name to value
    • toString

      public String toString()
      Overrides:
      toString in class Object