Class AllowedRegexRule

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

public class AllowedRegexRule extends Object implements Rule
Rule for determining if a password matches an allowed regular expression. Passwords must match the expression or validation will fail.
  • 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.
  • Constructor Details

    • AllowedRegexRule

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

      public AllowedRegexRule(String regex, int regexFlags)
      Creates a new allowed regex rule.
      Parameters:
      regex - regular expression
      regexFlags - regular expression flags
  • Method Details

    • 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()
      Creates the parameter data for the rule result detail.
      Returns:
      map of parameter name to value
    • toString

      public String toString()
      Overrides:
      toString in class Object