Package org.passay

Class AllowedCharacterRule

  • All Implemented Interfaces:
    Rule

    public class AllowedCharacterRule
    extends Object
    implements Rule
    Rule for determining if a password contains allowed characters. Validation will fail unless the password contains only allowed characters.
    Author:
    Middleware Services
    • Field Detail

      • reportAllFailures

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

      • AllowedCharacterRule

        public AllowedCharacterRule​(char[] c)
        Create a new allowed character rule.
        Parameters:
        c - allowed characters
      • AllowedCharacterRule

        public AllowedCharacterRule​(char[] c,
                                    MatchBehavior behavior)
        Create a new allowed character rule.
        Parameters:
        c - allowed characters
        behavior - how to match allowed characters
      • AllowedCharacterRule

        public AllowedCharacterRule​(char[] c,
                                    boolean reportAll)
        Create a new allowed character rule.
        Parameters:
        c - allowed characters
        reportAll - whether to report all matches or just the first
      • AllowedCharacterRule

        public AllowedCharacterRule​(char[] c,
                                    MatchBehavior behavior,
                                    boolean reportAll)
        Create a new allowed character rule.
        Parameters:
        c - allowed characters
        behavior - how to match allowed characters
        reportAll - whether to report all matches or just the first
    • Method Detail

      • getAllowedCharacters

        public char[] getAllowedCharacters()
        Returns the allowed characters for this rule.
        Returns:
        allowed characters
      • getMatchBehavior

        public MatchBehavior getMatchBehavior()
        Returns the match behavior for this rule.
        Returns:
        match behavior
      • 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​(char c)
        Creates the parameter data for the rule result detail.
        Parameters:
        c - illegal character
        Returns:
        map of parameter name to value
      • createRuleResultMetadata

        protected RuleResultMetadata createRuleResultMetadata​(PasswordData password)
        Creates the rule result metadata.
        Parameters:
        password - data used for metadata creation
        Returns:
        rule result metadata