Class SAMLProtocolAndRoleHandler

  • 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 SAMLProtocolAndRoleHandler
    extends org.opensaml.messaging.handler.AbstractMessageHandler
    SAML MessageHandler that attaches protocol and role information to a message context via SAMLProtocolContext and an instance of AbstractSAMLEntityContext objects. The entity context class is configurable and defaults to SAMLPeerEntityContext.

    A profile flow would typically run this handler after message decoding occurs, to bootstrap subsequent handlers.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.opensaml.messaging.context.navigate.ContextDataLookupFunction<org.opensaml.messaging.context.MessageContext,​? extends org.opensaml.messaging.context.BaseContext> copyContextLookup
      Optional lookup function for a context from which to copy the protocol and role data, for example from a parent operation context.
      private Class<? extends org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext> entityContextClass
      The context class representing the SAML entity for whom data is to be attached.
      private QName peerRole
      Role type to add to context.
      private String samlProtocol
      Protocol value to add to context.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doInitialize()
      protected void doInvoke​(org.opensaml.messaging.context.MessageContext messageContext)
      void setCopyContextLookup​(org.opensaml.messaging.context.navigate.ContextDataLookupFunction<org.opensaml.messaging.context.MessageContext,​? extends org.opensaml.messaging.context.BaseContext> lookup)
      Set the optional lookup function for a context from which to copy the protocol and role data, for example from a parent operation context.
      void setEntityContextClass​(Class<? extends org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext> clazz)
      Set the class type holding the SAML entity data.
      void setProtocol​(String protocol)
      Set the protocol constant to attach.
      void setRole​(QName role)
      Set the operational role to attach.
      • Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler

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

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

        initialize, isInitialized
    • Field Detail

      • samlProtocol

        @NonnullAfterInit
        @NotEmpty
        private String samlProtocol
        Protocol value to add to context.
      • peerRole

        @NonnullAfterInit
        private QName peerRole
        Role type to add to context.
      • entityContextClass

        @Nonnull
        private Class<? extends org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext> entityContextClass
        The context class representing the SAML entity for whom data is to be attached. Defaults to: SAMLPeerEntityContext.
      • copyContextLookup

        @Nullable
        private org.opensaml.messaging.context.navigate.ContextDataLookupFunction<org.opensaml.messaging.context.MessageContext,​? extends org.opensaml.messaging.context.BaseContext> copyContextLookup
        Optional lookup function for a context from which to copy the protocol and role data, for example from a parent operation context.
    • Constructor Detail

      • SAMLProtocolAndRoleHandler

        public SAMLProtocolAndRoleHandler()
    • Method Detail

      • setCopyContextLookup

        public void setCopyContextLookup​(@Nullable
                                         org.opensaml.messaging.context.navigate.ContextDataLookupFunction<org.opensaml.messaging.context.MessageContext,​? extends org.opensaml.messaging.context.BaseContext> lookup)
        Set the optional lookup function for a context from which to copy the protocol and role data, for example from a parent operation context.
        Parameters:
        lookup - the lookup function, may be null
      • setEntityContextClass

        public void setEntityContextClass​(@Nonnull
                                          Class<? extends org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext> clazz)
        Set the class type holding the SAML entity data.

        Defaults to: SAMLPeerEntityContext.

        Parameters:
        clazz - the entity context class type
      • setProtocol

        public void setProtocol​(@Nonnull @NotEmpty
                                String protocol)
        Set the protocol constant to attach.
        Parameters:
        protocol - the protocol constant to set
      • setRole

        public void setRole​(@Nonnull
                            QName role)
        Set the operational role to attach.
        Parameters:
        role - the operational role to set
      • 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
      • doInvoke

        protected void doInvoke​(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