Class AbstractProfileAction

  • 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.profile.action.ProfileAction, Aware, MessageSource, MessageSourceAware, Action
    Direct Known Subclasses:
    AbstractProfileInterceptorAction, ScriptedAction

    @ThreadSafe
    public abstract class AbstractProfileAction
    extends org.opensaml.profile.action.AbstractConditionalProfileAction
    implements Action, MessageSource, MessageSourceAware
    Base class for Spring-aware profile actions.

    This base class takes care of the following:

    • retrieving the ProfileRequestContext from the current request environment
    • populating the SWF RequestContext into the profile context tree
    • starting or stopping any timers as instructed by a MetricContext in the tree

    Action implementations may override doExecute(RequestContext, ProfileRequestContext) if they require SWF functionality, but most should override AbstractProfileAction.doExecute(ProfileRequestContext) instead.

    • Field Detail

      • log

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

        @Nonnull
        private Function<RequestContext,​org.opensaml.profile.context.ProfileRequestContext> profileContextLookupStrategy
        Strategy used to lookup the ProfileRequestContext from a given WebFlow RequestContext.
      • messageSource

        @Nonnull
        private MessageSource messageSource
        MessageSource injected by Spring, typically the parent ApplicationContext itself.
    • Method Detail

      • getProfileContextLookupStrategy

        @Nonnull
        public Function<RequestContext,​org.opensaml.profile.context.ProfileRequestContext> getProfileContextLookupStrategy()
        Get the strategy used to lookup the ProfileRequestContext from a given WebFlow RequestContext.
        Returns:
        lookup strategy
      • setProfileContextLookupStrategy

        public void setProfileContextLookupStrategy​(@Nonnull
                                                    Function<RequestContext,​org.opensaml.profile.context.ProfileRequestContext> strategy)
        Set the strategy used to lookup the ProfileRequestContext from a given WebFlow RequestContext.
        Parameters:
        strategy - lookup strategy
      • doExecute

        @Nonnull
        protected Event doExecute​(@Nonnull
                                  RequestContext springRequestContext,
                                  @Nonnull
                                  org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
        Spring-aware actions can override this method to fully control the execution of an Action by the Web Flow engine.

        Alternatively they may override AbstractProfileAction.doExecute(ProfileRequestContext) and access Spring information via a SpringRequestContext attached to the profile request context.

        The default implementation attaches the Spring Web Flow request context to the profile request context tree to "narrow" the execution signature to the basic OpenSAML ProfileAction interface. After execution, an EventContext is sought, and used to return a result back to the Web Flow engine. If no context exists, a "proceed" event is signaled.

        Parameters:
        springRequestContext - the Spring request context
        profileRequestContext - a profile request context
        Returns:
        a Web Flow event produced by the action
      • getResult

        @Nonnull
        protected Event getResult​(@Nonnull
                                  org.opensaml.profile.action.ProfileAction action,
                                  @Nonnull
                                  org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
        Examines the profile context for an event to return, or signals a successful outcome if no EventContext is located; the EventContext will be removed upon completion.

        The EventContext must contain a Spring Web Flow Event or a String. Any other type of context data will be ignored.

        Parameters:
        action - the action signaling the event
        profileRequestContext - the profile request context to examine
        Returns:
        an event based on the profile request context, or "proceed"
      • getRequestContext

        @Nullable
        protected RequestContext getRequestContext​(@Nonnull
                                                   org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
        Gets the Spring RequestContext from a SpringRequestContext stored in the context tree.
        Parameters:
        profileRequestContext - Profile request context.
        Returns:
        Spring request context.