Class DynamicAttributePredicate

  • All Implemented Interfaces:
    Predicate<org.opensaml.profile.context.ProfileRequestContext>, net.shibboleth.utilities.java.support.logic.Predicate<org.opensaml.profile.context.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.
    Since:
    3.4.0
    • Field Detail

      • log

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

        @Nonnull
        @NonnullElements
        private ListMultimap<String,​Function<org.opensaml.profile.context.ProfileRequestContext,​String>> attributeFunctionMap
        Map of attribute IDs to functions.
    • Constructor Detail

      • DynamicAttributePredicate

        public DynamicAttributePredicate()
        Constructor.
    • Method Detail

      • setAttributeFunctionMap

        public void setAttributeFunctionMap​(@Nonnull @NonnullElements
                                            Map<String,​Collection<Function<org.opensaml.profile.context.ProfileRequestContext,​String>>> 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
                            org.opensaml.profile.context.ProfileRequestContext input)
        Specified by:
        test in interface Predicate<org.opensaml.profile.context.ProfileRequestContext>
        Overrides:
        test in class AbstractAttributePredicate
      • hasMatch

        protected boolean hasMatch​(@Nonnull @NonnullElements
                                   Map<String,​net.shibboleth.idp.attribute.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
                                   org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                   @Nonnull @NonnullElements
                                   Map<String,​net.shibboleth.idp.attribute.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
                                    net.shibboleth.idp.attribute.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