Class RegexpBlacklistEidValidator

  • All Implemented Interfaces:
    EidValidator

    public class RegexpBlacklistEidValidator
    extends Object
    implements EidValidator
    Implements User EID "validation" by checking for matches in a configurable blacklist, entries in which are treated as regular expressions.
    Author:
    dmccallum
    • Constructor Detail

      • RegexpBlacklistEidValidator

        public RegexpBlacklistEidValidator()
    • Method Detail

      • isMinimallyValidEid

        protected boolean isMinimallyValidEid​(String eid)
        As implemented requires that the given ID be non-null and non-whitespace.
        Parameters:
        eid - and EID to test
        Returns:
        true unless the given String is null or entirely whitespace
      • isBlackListedEid

        protected boolean isBlackListedEid​(String eid)
        Encapsulates the logic for actually checking a user EID against the configured blacklist. If no blacklist is configured, will return false
        Returns:
        true if the eid matches a configured blacklist pattern. false otherwise (e.g. if no configured blacklist).
      • getEidBlacklist

        public Collection<String> getEidBlacklist()
        Access the String representation of blacklisted User EID regexps configured on this object. The returned collection may or may not be equivalent to the collection passed to setEidBlacklist(Collection)
        Returns:
      • setEidBlacklist

        public void setEidBlacklist​(Collection<String> eidBlacklist)
        Converts the given collection of Strings into a collection of s and caches the latter for evaluation by isSearchableEid(String). Configure {link Pattern} evaluation flags with setRegexpFlags(int).
        Parameters:
        eidBlacklist - a collection of Strings to be compiled into Patterns. May be null, which will have the same semantics as an empty collection.
      • setRegexpFlags

        public void setRegexpFlags​(int regexpFlags)
        Assign a bitmask for Pattern matching behaviors. Be sure to set this property prior to invoking setEidBlacklist(Collection). The cached Patterns will not be recompiled as a side-effect of invoking this method.
        Parameters:
        regexpFlags -