Class DynamicAttributePredicate

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

public class DynamicAttributePredicate extends AbstractAttributePredicate
Predicate over an AttributeContext that derives the value(s) to match based on one or more supplied Functions instead of static values.

Each function installed must return a value that matches a value of the attribute corresponding to the map key.

Functions may return a String or a Collection containing them.

Since:
3.4.0
  • Field Details

  • Constructor Details

    • DynamicAttributePredicate

      public DynamicAttributePredicate()
      Constructor.
  • Method Details

    • setAttributeFunctionMap

      public void setAttributeFunctionMap(@Nonnull Map<String,Collection<Function<ProfileRequestContext,Object>>> map)
      Set the map of attribute/function pairs (as a map of function collections) to check for.
      Parameters:
      map - map of attribute/function pairs
    • test

      public boolean test(@Nullable ProfileRequestContext input)
      Specified by:
      test in interface Predicate<ProfileRequestContext>
      Overrides:
      test in class AbstractAttributePredicate
    • hasMatch

      protected boolean hasMatch(@Nonnull Map<String,IdPAttribute> attributeMap)
      Abstract implementation of the condition to evaluate.
      Specified by:
      hasMatch in class AbstractAttributePredicate
      Parameters:
      attributeMap - the attributes to evaluate
      Returns:
      the condition result
    • hasMatch

      protected boolean hasMatch(@Nullable ProfileRequestContext profileRequestContext, @Nonnull Map<String,IdPAttribute> attributeMap)
      Implementation of the condition to evaluate.
      Parameters:
      profileRequestContext - current profile request context
      attributeMap - the attributes to evaluate
      Returns:
      the condition result
    • findMatch

      protected boolean findMatch(@Nonnull @NotEmpty String toMatch, @Nonnull IdPAttribute attribute)
      Look for a matching value in an attribute.
      Parameters:
      toMatch - value to look for
      attribute - attribute to check
      Returns:
      true iff the value is one of the attribute's values