Class ProcessAssertionsForAuthentication
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.sp.profile.AbstractAgentRequestAction
net.shibboleth.sp.profile.AbstractAgentAction
net.shibboleth.sp.profile.AbstractApplicationAction
net.shibboleth.sp.saml.saml2.profile.impl.ProcessAssertionsForAuthentication
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
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.
This is a copy of an IdP action for the time being as there was no way to override the desired behavior.
- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_MESSAGE- Postcondition:
- the selected statement is passed into the supplied
BiConsumer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classPredicate for assertions containing at least 1 AuthenticationStatement.private final classPredicate for assertions which have been validated and have a confirmed Subject.private final classPredicate for valid assertions. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe registry of predicate factories for custom principal evaluation.private final org.slf4j.LoggerLogger.private ResponseThe Response to process.private Function<ProfileRequestContext,Response> The resolver for the response to be processed."Sink" for preserving SAML objects.private SAMLStateDataState data to validate.Strategy used to locate theStateDataContextto check. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddValidationError(String msg) Adds a validation error for the agent regarding the failure.protected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) private booleanisAcceptable(RequestedPrincipalContext helperContext, AuthnContext authnContext) Process anAuthnContextfor compatibility with the request as brokered by the populatedRequestedPrincipalContext.voidSet the registry of predicate factories for custom principal evaluation.voidsetResponseResolver(Function<ProfileRequestContext, Response> strategy) Set the strategy function which resolves the response to process.voidSet theBiConsumerused to save off the SAML statemen and any related objects as a result of this action.voidSets the strategy used to lookup theStateDataContext.Methods inherited from class net.shibboleth.sp.profile.AbstractApplicationAction
ensureApplication, getApplicationMethods inherited from class net.shibboleth.sp.profile.AbstractAgentAction
ensureAgent, getAgentMethods inherited from class net.shibboleth.sp.profile.AbstractAgentRequestAction
ensureAgentRequestContext, getAgentRequestContext, setAgentRequestContextLookupStrategyMethods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logLogger. -
responseResolver
The resolver for the response to be processed. -
samlConsumer
"Sink" for preserving SAML objects. -
stateDataContextLookupStrategy
Strategy used to locate theStateDataContextto check. -
evalRegistry
The registry of predicate factories for custom principal evaluation. -
response
The Response to process. -
stateData
State data to validate.
-
-
Constructor Details
-
ProcessAssertionsForAuthentication
public ProcessAssertionsForAuthentication()Constructor.
-
-
Method Details
-
setResponseResolver
Set the strategy function which resolves the response to process.- Parameters:
strategy- the new strategy function
-
setSAMLConsumer
Set theBiConsumerused 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
-
setStateDataContextLookupStrategy
public void setStateDataContextLookupStrategy(@Nonnull Function<ProfileRequestContext, StateDataContext> strategy) Sets the strategy used to lookup theStateDataContext.- Parameters:
strategy- lookup strategy
-
setPrincipalEvalPredicateFactoryRegistry
public void setPrincipalEvalPredicateFactoryRegistry(@Nonnull PrincipalEvalPredicateFactoryRegistry registry) Set the registry of predicate factories for custom principal evaluation.- Parameters:
registry- predicate factory registry
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractApplicationAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
isAcceptable
private boolean isAcceptable(@Nonnull RequestedPrincipalContext helperContext, @Nullable AuthnContext authnContext) Process anAuthnContextfor compatibility with the request as brokered by the populatedRequestedPrincipalContext.- Parameters:
helperContext- populated context to drive context evaluationauthnContext- input context object from assertion statement- Returns:
- true iff the context carries an ACR that is compatible with the request
-
addValidationError
Adds a validation error for the agent regarding the failure.- Parameters:
msg- error message
-