Class LoopDetectionPredicate

java.lang.Object
net.shibboleth.profile.context.logic.AbstractRelyingPartyPredicate
net.shibboleth.profile.context.logic.LoopDetectionPredicate
All Implemented Interfaces:
Predicate<ProfileRequestContext>

public class LoopDetectionPredicate extends AbstractRelyingPartyPredicate
A condition that relies on a Meter to detect looping SPs.
Since:
4.1.0
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • privateRegistry

      @Nonnull private final com.codahale.metrics.MetricRegistry privateRegistry
      Private registry to isolate timers.
    • threshold

      private long threshold
      Count to trigger warning.
    • relyingPartyMap

      @Nonnull private Map<String,String> relyingPartyMap
      Map of RP names to meter names.
    • activationCondition

      @Nonnull private Predicate<ProfileRequestContext> activationCondition
      Generalized condition in place of dedicated map.
    • tagGenerationStrategy

      @Nonnull private Function<ProfileRequestContext,String> tagGenerationStrategy
      Used with generalized condition to compute name to use in loop metric.
    • usernameLookupStrategy

      @Nonnull private Function<ProfileRequestContext,String> usernameLookupStrategy
      Lookup strategy to obtain subject name.
  • Constructor Details

  • Method Details

    • setThreshold

      public void setThreshold(@Positive long value)
      Set the warning threshold for the 1 minute moving average to exceed.

      Defaults to 20.

      Parameters:
      value - threshold to use
    • setRelyingPartyMap

      public void setRelyingPartyMap(@Nullable Map<String,String> map)
      Set the map of relying party names to meter names to track counts.
      Parameters:
      map - map of RP/meter mappings
    • setUsernameLookupStrategy

      public void setUsernameLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
      Set lookup strategy to obtain username.
      Parameters:
      strategy - lookup strategy
    • setActivationCondition

      public void setActivationCondition(@Nonnull Predicate<ProfileRequestContext> condition)
      Sets a generalized activation condition to apply in addition to the hardcoded map of RPs.

      Defaults to false.

      Parameters:
      condition - condition to set
      Since:
      5.2.0
    • setTagGenerationStrategy

      public void setTagGenerationStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
      Sets a generalized tag generation strategy to produce the loop detection metric name.

      Defaults to the SHA-1 hash of the RP name.

      Parameters:
      strategy - function to produce metric name
      Since:
      5.2.0
    • test

      public boolean test(@Nullable ProfileRequestContext input)