Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A profile action is a discrete piece of code, packaged into a Java bean, that peforms a specific function, such as building a SAML assertion, signing a message, encrypting an attribute, validating a password, or displaying a message to a user. Just as the functionality in the IdP is made up of "profiles", a profile is implemented by connecting together a series of profile action beans into a sequence of steps. The steps can be sequential or include conditional branches based on data or user input.

Spring Web Flow is the mechanism used to orchestrate the sequence of actions that implement a complete profile. Authentication is also implemented using a reusable set of web flows that support the login mechanisms a deployer wants to enable, and new mechanisms can be added by implementing small amounts of code and configuring new flows.

The interface used by Spring to invoke an action bean is org.springframework.webflow.execution.Action and a single method is used:

SWF Action interface
package org.springframework.webflow.execution;

public interface Action {
    public Event execute(RequestContext context) throws Exception;
} 

All action beans ultimately support this interface. However, the vast majority of beans in the IdP will implement an OpenSAML interface, org.opensaml.profile.action.ProfileAction, which is a Spring-independent interface with a similarly simple interface:

OpenSAML ProfileAction interface
package org.opensaml.profile.action;

public interface ProfileAction<InboundMessageType, OutboundMessageType> extends
        IdentifiableComponent, InitializableComponent, ValidatableComponent {
    public void execute(
            final ProfileRequestContext<InboundMessageType, OutboundMessageType> profileRequestContext)
            throws ProfileException;
} 

You can see the obvious intentional symmetry between these interfaces. The purpose of the OpenSAML interface is to support independence from Spring when possible, and make a larger amount of functional SAML processing code available to OpenSAML users that are implementing their own applications.

Spring-Independent Actions

More often then not, a profile action bean will not need access to the Spring Web Flow context or the Spring container, in which case it will not need to implement the Web Flow interface itself, just the OpenSAML interface. Usually this is done by deriving a bean from the org.opensaml.profile.action.AbstractProfileAction base class and overriding this method:

Implementing an OpenSAML ProfileAction
public void doExecute(final ProfileRequestContext<InboundMessageType, OutboundMessageType> profileRequestContext)
	throws ProfileException;

The action bean interacts with the environment using the ProfileRequestContext, which is the root of an extensible tree of context objects representing the state of a profile execution, the inputs to the action, and the outputs of the action when it completes. If executing in a servlet container, the action can access the servlet objects using methods on the context.

When an action completes, it need do nothing to signal a flow to continue, or it can signal a more complex transition by throwing an exception or more commonly by attaching an org.opensaml.profile.context.EventContext object to the context tree.

Spring-Based Actions

If an action bean requires access to the Spring Web Flow context object or

  • No labels