Class SAMLAddAttributeConsumingServiceHandler

  • All Implemented Interfaces:
    net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, org.opensaml.messaging.handler.MessageHandler

    public class SAMLAddAttributeConsumingServiceHandler
    extends org.opensaml.messaging.handler.AbstractMessageHandler
    SAML MessageHandler that attaches an AttributeConsumingServiceContext to the SAMLMetadataContext based on the content of an AuthnRequest in the message context.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.saml2.core.AuthnRequest> authnRequestLookupStrategy
      Lookup strategy for an AuthnRequest index.
      private Integer index
      AttributeConsumingService index - if specified.
      private org.slf4j.Logger log
      Logger.
      private Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.common.messaging.context.SAMLMetadataContext> metadataContextLookupStrategy
      Lookup strategy for SAMLMetadataContext.
      private List<org.opensaml.saml.saml2.metadata.RequestedAttribute> requestedAttributes
      RequestedAttribute list - if specified.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.opensaml.saml.saml2.metadata.AttributeConsumingService attributeConsumingServiceFromRequestedAttributes()
      Generate an AttributeConsumingService from the RequestedAttributes.
      protected void doInvoke​(org.opensaml.messaging.context.MessageContext messageContext)
      protected boolean doPreInvoke​(org.opensaml.messaging.context.MessageContext messageContext)
      private List<org.opensaml.saml.saml2.metadata.RequestedAttribute> getRequestedAttributes​(org.opensaml.saml.saml2.core.AuthnRequest authn)
      Grab the RequestedAttribute (if any) from the AuthnRequest.
      void setIndexLookupStrategy​(Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.saml2.core.AuthnRequest> strategy)
      Set the strategy to locate the AttributeConsumingService index from the MessageContext.
      void setMetadataContextLookupStrategy​(Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.common.messaging.context.SAMLMetadataContext> strategy)
      Set the strategy to locate the SAMLMetadataContext from the MessageContext.
      • Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler

        doPostInvoke, doPostInvoke, getActivationCondition, getLogPrefix, invoke, setActivationCondition
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
      • Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent

        initialize, isInitialized
    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Logger.
      • metadataContextLookupStrategy

        @Nonnull
        private Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.common.messaging.context.SAMLMetadataContext> metadataContextLookupStrategy
        Lookup strategy for SAMLMetadataContext.
      • authnRequestLookupStrategy

        @Nonnull
        private Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.saml2.core.AuthnRequest> authnRequestLookupStrategy
        Lookup strategy for an AuthnRequest index.
      • index

        @Nullable
        private Integer index
        AttributeConsumingService index - if specified.
      • requestedAttributes

        @Nullable
        private List<org.opensaml.saml.saml2.metadata.RequestedAttribute> requestedAttributes
        RequestedAttribute list - if specified.
    • Constructor Detail

      • SAMLAddAttributeConsumingServiceHandler

        public SAMLAddAttributeConsumingServiceHandler()
        Constructor.
    • Method Detail

      • setMetadataContextLookupStrategy

        public void setMetadataContextLookupStrategy​(@Nonnull
                                                     Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.common.messaging.context.SAMLMetadataContext> strategy)
        Set the strategy to locate the SAMLMetadataContext from the MessageContext.
        Parameters:
        strategy - lookup strategy
      • setIndexLookupStrategy

        public void setIndexLookupStrategy​(@Nullable
                                           Function<org.opensaml.messaging.context.MessageContext,​org.opensaml.saml.saml2.core.AuthnRequest> strategy)
        Set the strategy to locate the AttributeConsumingService index from the MessageContext.
        Parameters:
        strategy - lookup strategy
      • doPreInvoke

        protected boolean doPreInvoke​(@Nonnull
                                      org.opensaml.messaging.context.MessageContext messageContext)
                               throws org.opensaml.messaging.handler.MessageHandlerException
        Overrides:
        doPreInvoke in class org.opensaml.messaging.handler.AbstractMessageHandler
        Throws:
        org.opensaml.messaging.handler.MessageHandlerException
      • doInvoke

        protected void doInvoke​(@Nonnull
                                org.opensaml.messaging.context.MessageContext messageContext)
                         throws org.opensaml.messaging.handler.MessageHandlerException
        Specified by:
        doInvoke in class org.opensaml.messaging.handler.AbstractMessageHandler
        Throws:
        org.opensaml.messaging.handler.MessageHandlerException
      • attributeConsumingServiceFromRequestedAttributes

        private org.opensaml.saml.saml2.metadata.AttributeConsumingService attributeConsumingServiceFromRequestedAttributes()
                                                                                                                     throws org.opensaml.messaging.handler.MessageHandlerException
        Generate an AttributeConsumingService from the RequestedAttributes.
        Returns:
        a suitable AttributeConsumingService
        Throws:
        org.opensaml.messaging.handler.MessageHandlerException - when the cloning failed
      • getRequestedAttributes

        private List<org.opensaml.saml.saml2.metadata.RequestedAttribute> getRequestedAttributes​(org.opensaml.saml.saml2.core.AuthnRequest authn)
        Grab the RequestedAttribute (if any) from the AuthnRequest.
        Parameters:
        authn - the request to interrogate
        Returns:
        null or the list.