Package net.shibboleth.sp.profile.impl
Class PreservePostData
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.profile.impl.PreservePostData
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
Action that detects submitted form data, and when permitted, stores it in a
StorageService and
issues a cookie associated with the active state token to preserve a pointer to the data for recovery.
The state token to bind to is collected from a StateDataContext accessed via lookup strategy.
The action also has support for detecting data previously preserved by this action by checking for
a SPConstants.STATE member in the input message and using that to recover the data and clean up
that record so it can be re-associated with the new state token found in the context.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CookieManagerCookie manager.private StringCookie prefix.static StringDefault cookie prefix.private booleanWhether an error constructing a correlation cookie is fatal.private IdentifierGenerationStrategyIdentifier generation.private DurationLifetime for data in storage.private org.slf4j.LoggerClass logger.private StringPOST data to preserve in record.Strategy used to create theStateDataContextto bind to.private StringState token vakue used in cookie name.private StorageServiceStorage service for data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) (package private) StringgetCookieName(String stateToken) Computes the cookie name based on the configured prefix and state token.private StringgetPreviousData(ProfileRequestContext profileRequestContext) Checks for previously preserved data tracked against a state token submitted by the agent.private StringGets data submitted with this request, if any.voidsetCookieManager(CookieManager manager) Sets theCookieManagerto use.voidsetCookiePrefix(String prefix) Sets the cookie prefix.voidsetErrorFatal(boolean flag) Sets whether an error computing a state token should result in a fatal event.voidSetIdentifierGenerationStrategyto use.voidsetLifetime(Duration dur) Set the lifetime for data in storage.voidSets the strategy used to lookup theStateDataContext.voidsetStorageService(StorageService storage) SetStorageServiceto use.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
-
DEFAULT_COOKIE_PREFIX
Default cookie prefix. -
log
@Nonnull private org.slf4j.Logger logClass logger. -
stateDataContextLookupStrategy
Strategy used to create theStateDataContextto bind to. -
identifierStrategy
Identifier generation. -
lifetime
Lifetime for data in storage. -
storageService
Storage service for data. -
cookieManager
Cookie manager. -
cookiePrefix
Cookie prefix. -
errorFatal
private boolean errorFatalWhether an error constructing a correlation cookie is fatal. -
stateToken
State token vakue used in cookie name. -
postData
POST data to preserve in record.
-
-
Constructor Details
-
PreservePostData
public PreservePostData()Constructor.
-
-
Method Details
-
setStateDataContextLookupStrategy
public void setStateDataContextLookupStrategy(@Nonnull Function<ProfileRequestContext, StateDataContext> strategy) Sets the strategy used to lookup theStateDataContext.- Parameters:
strategy- lookup strategy
-
setLifetime
Set the lifetime for data in storage.Defaults to PT5M.
- Parameters:
dur- data lifetime
-
setStorageService
SetStorageServiceto use.- Parameters:
storage- storage service
-
setCookiePrefix
Sets the cookie prefix.Defaults to
DEFAULT_COOKIE_PREFIX.- Parameters:
prefix- cookie prefix
-
setErrorFatal
public void setErrorFatal(boolean flag) Sets whether an error computing a state token should result in a fatal event.Defaults to false.
- Parameters:
flag- flag to set
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractApplicationAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
getSubmittedData
Gets data submitted with this request, if any.- Returns:
- submitted data or null
-
getPreviousData
Checks for previously preserved data tracked against a state token submitted by the agent.This case is triggered by use of discovery, which would have preserved the data against the state token issued at that time, which we have since recovered and disposed of.
- Parameters:
profileRequestContext- profile request context- Returns:
- previous data or null
-
getCookieName
Computes the cookie name based on the configured prefix and state token.Package private access for unit tests.
- Parameters:
stateToken- the state token- Returns:
- the cookie name
-