Interface GuardPredicate

All Known Implementing Classes:
ExtPredicate, RateLimitPredicate

public interface GuardPredicate
One condition of a guard rule (e.g. "uri~^/admin/", "!cookie:hruc"). Implementations run on the request thread for every request, before cache and origin, so they must be cheap and must never throw: a predicate that cannot decide returns false.
  • Method Details

    • test

      boolean test(RequestContext context)
      Parameters:
      context - request context - may carry a null servlet request (async include, or a synthetic probe context used for startup loop detection)
      Returns:
      true when this condition holds for the request
    • describe

      String describe()
      Returns:
      the predicate as written in guard-rules.conf (used by logs and the admin API)
    • isPluginPredicate

      default boolean isPluginPredicate()
      Whether a plugin answers this predicate (ext:, negated or not) - code the node does not own, which may have no answer (PredicateUndecided). An allow rule naming one must say on-error=allow.
    • pluginPredicate

      default ExtPredicate pluginPredicate()
      The plugin's predicate this one is, or negates; null for a core predicate.