Class AbstractNameIDPolicyPredicate

  • All Implemented Interfaces:
    Predicate<org.opensaml.profile.context.ProfileRequestContext>, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, net.shibboleth.utilities.java.support.logic.Predicate<org.opensaml.profile.context.ProfileRequestContext>
    Direct Known Subclasses:
    DefaultNameIDPolicyPredicate

    public abstract class AbstractNameIDPolicyPredicate
    extends net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
    implements net.shibboleth.utilities.java.support.logic.Predicate<org.opensaml.profile.context.ProfileRequestContext>
    Base class for implementations of Predicate that handle evaluation of name identifier content in various scenarios.
    • Field Detail

      • log

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

        @Nullable
        private Function<org.opensaml.profile.context.ProfileRequestContext,​String> requesterIdLookupStrategy
        Requester ID lookup function.
      • responderIdLookupStrategy

        @Nullable
        private Function<org.opensaml.profile.context.ProfileRequestContext,​String> responderIdLookupStrategy
        Responder ID lookup function.
      • objectLookupStrategy

        @NonnullAfterInit
        private Function<org.opensaml.profile.context.ProfileRequestContext,​SAMLObject> objectLookupStrategy
        Object lookup function.
      • formats

        @Nonnull
        @NonnullElements
        private Set<String> formats
        Formats to apply policy to.
    • Constructor Detail

      • AbstractNameIDPolicyPredicate

        public AbstractNameIDPolicyPredicate()
        Constructor.
    • Method Detail

      • setRequesterIdLookupStrategy

        public void setRequesterIdLookupStrategy​(@Nullable
                                                 Function<org.opensaml.profile.context.ProfileRequestContext,​String> strategy)
        Set the strategy used to locate the requester ID.
        Parameters:
        strategy - lookup strategy
      • setResponderIdLookupStrategy

        public void setResponderIdLookupStrategy​(@Nullable
                                                 Function<org.opensaml.profile.context.ProfileRequestContext,​String> strategy)
        Set the strategy used to locate the responder ID.
        Parameters:
        strategy - lookup strategy
      • setObjectLookupStrategy

        public void setObjectLookupStrategy​(@Nullable
                                            Function<org.opensaml.profile.context.ProfileRequestContext,​SAMLObject> strategy)
        Set the lookup strategy used to locate the object to evaluate.
        Parameters:
        strategy - lookup function
      • setFormats

        public void setFormats​(@Nullable
                               Collection<String> newFormats)
        Set the formats to apply the predicate to.
        Parameters:
        newFormats - formats to apply predicate to
      • doInitialize

        protected void doInitialize()
                             throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
        Overrides:
        doInitialize in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
        Throws:
        net.shibboleth.utilities.java.support.component.ComponentInitializationException
      • test

        public boolean test​(@Nullable
                            org.opensaml.profile.context.ProfileRequestContext input)
        Specified by:
        test in interface Predicate<org.opensaml.profile.context.ProfileRequestContext>
      • doApply

        private boolean doApply​(@Nullable
                                org.opensaml.profile.context.ProfileRequestContext input,
                                @Nonnull
                                NameIdentifier target)
        Apply policy to the target object.
        Parameters:
        input - current profile request context
        target - target object
        Returns:
        result of policy
      • doApply

        private boolean doApply​(@Nullable
                                org.opensaml.profile.context.ProfileRequestContext input,
                                @Nonnull
                                NameID target)
        Apply policy to the target object.
        Parameters:
        input - current profile request context
        target - target object
        Returns:
        result of policy
      • doApply

        private boolean doApply​(@Nullable
                                org.opensaml.profile.context.ProfileRequestContext input,
                                @Nonnull
                                NameIDPolicy target)
        Apply policy to the target object.
        Parameters:
        input - current profile request context
        target - target object
        Returns:
        result of policy
      • doApply

        protected abstract boolean doApply​(@Nullable
                                           String requesterId,
                                           @Nullable
                                           String responderId,
                                           @Nullable
                                           String format,
                                           @Nullable
                                           String nameQualifier,
                                           @Nullable
                                           String spNameQualifier)
        Apply the predicate to the request.
        Parameters:
        requesterId - the requester
        responderId - the responder
        format - format of identifier
        nameQualifier - the NameQualifier
        spNameQualifier - the SPNameQualifier
        Returns:
        true iff the combination of inputs satisfies a policy