Class ProcessAssertionsForAuthentication

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, ProfileAction, Aware, MessageSource, MessageSourceAware, Action

public class ProcessAssertionsForAuthentication extends AbstractProfileAction
Perform processing of a SAML 2 Response's Assertions that have been validated by earlier actions for use in finalization of SAML-based authentication by later actions.

The result of this action is to strip any invalid assertions from the response, and to preserve the "best"/selected AuthnStatement and any other content required in a pluggable manner.

The default behavior is to store the statement and the related Subject in a SAMLAuthnContext located by a lookup strategy.

Event:
EventIds.PROCEED_EVENT_ID, EventIds.INVALID_MESSAGE, AuthnEventIds.INVALID_CREDENTIALS
Postcondition:
the selected statement is passed into the supplied BiConsumer
  • Field Details

  • Constructor Details

    • ProcessAssertionsForAuthentication

      public ProcessAssertionsForAuthentication()
      Constructor.
  • Method Details

    • setAuthnAssertionSelectionStrategy

      public void setAuthnAssertionSelectionStrategy(@Nonnull Function<List<Assertion>,Assertion> strategy)
      Set the strategy function for selecting which of multiple valid Assertions to use.
      Parameters:
      strategy - the new strategy function
    • setAuthnStatementSelectionStrategy

      public void setAuthnStatementSelectionStrategy(@Nonnull Function<Assertion,AuthnStatement> strategy)
      Set the strategy function for selecting which of multiple AuthnStatements to use.
      Parameters:
      strategy - the new strategy function
    • setResponseResolver

      public void setResponseResolver(@Nonnull Function<ProfileRequestContext,Response> strategy)
      Set the strategy function which resolves the response to process.
      Parameters:
      strategy - the new strategy function
    • setSAMLAuthnContextLookupStrategy

      public void setSAMLAuthnContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SAMLAuthnContext> strategy)
      Set the lookup strategy used to locate the SAMLAuthnContext.
      Parameters:
      strategy - the new strategy function
    • setSAMLConsumer

      public void setSAMLConsumer(@Nonnull BiConsumer<ProfileRequestContext,AuthnStatement> consumer)
      Set the BiConsumer used to save off the SAML statemen and any related objects as a result of this action.

      This insulates the actiion from the specific context in which it may be used. The supplied consumer MUST establish any non-successful event via the supplied context if it fails.

      Parameters:
      consumer - consumer to set
    • doPreExecute

      protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)
      Overrides:
      doPreExecute in class AbstractConditionalProfileAction
    • doExecute

      protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)
      Overrides:
      doExecute in class AbstractProfileAction