Package net.shibboleth.idp.consent.flow.storage.impl

# Class AbstractConsentStorageAction

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.idp.profile.interceptor.AbstractProfileInterceptorAction
net.shibboleth.idp.consent.flow.impl.AbstractConsentAction
net.shibboleth.idp.consent.flow.storage.impl.AbstractConsentStorageAction

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

Direct Known Subclasses:
  `AbstractConsentIndexedStorageAction`, `ReadConsentFromStorage`, `UpdateCounter`

public abstract class AbstractConsentStorageAction extends AbstractConsentAction
Base class for consent actions which interact with a `StorageService`. This action ensures that the storage service, serializer, storageContext, and storageKey are available. The storage service is provided by the profile interceptor flow descriptor. The storage serializer defaults to a `ConsentSerializer`. The storage context defaults to the flow ID provided by a `FlowIdLookupFunction`.

Precondition:

      InterceptorContext.getAttemptedFlow() != null

  ,

      FlowDescriptor.getStorageService() != null

  ,

      StorageSerializer != null

  ,

      StorageContextLookupStrategy != null

  ,

      StorageKeyLookupStrategy != null

  ,

      storageContextLookupStrategy.apply(profileRequestContext) != null

  ,

      storageKeyLookupStrategy.apply(profileRequestContext) != null

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private String`
`storageContext`
Storage context resulting from lookup strategy.
`private Function<ProfileRequestContext,String>`
`storageContextLookupStrategy`
Strategy used to determine the storage context.
`private String`
`storageKey`
Storage key resulting from lookup strategy.
`private Function<ProfileRequestContext,String>`
`storageKeyLookupStrategy`
Strategy used to determine the storage key.
`private StorageSerializer<Map<String,Consent>>`
`storageSerializer`
Storage serializer.
`private StorageService`
`storageService`
Storage service from the `ProfileInterceptorFlowDescriptor`.

## Constructor Summary

Constructors
Constructor
Description
`AbstractConsentStorageAction()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`protected boolean`
`doPreExecute(ProfileRequestContext profileRequestContext, ProfileInterceptorContext interceptorContext)`
Performs this profile interceptor action's pre-execute step.
`String`
`getStorageContext()`
Get the storage context resulting from applying the storage context lookup strategy.
`Function<ProfileRequestContext,String>`
`getStorageContextLookupStrategy()`
Get the storage context lookup strategy.
`String`
`getStorageKey()`
Get the storage key resulting from applying the storage key lookup strategy.
`Function<ProfileRequestContext,String>`
`getStorageKeyLookupStrategy()`
Get the storage key lookup strategy.
`StorageSerializer<Map<String,Consent>>`
`getStorageSerializer()`
Get the storage serializer.
`StorageService`
`getStorageService()`
Get the storage service from the `ProfileInterceptorFlowDescriptor`.
`void`
`setStorageContextLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the storage context lookup strategy.
`void`
`setStorageKeyLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the storage key lookup strategy.
`void`
`setStorageSerializer(StorageSerializer<Map<String,Consent>> serializer)`
Set the storage serializer.

### Methods inherited from class net.shibboleth.idp.consent.flow.impl.AbstractConsentAction

`getConsentContext, getConsentFlowDescriptor, setConsentContextLookupStrategy`

### Methods inherited from class net.shibboleth.idp.profile.interceptor.AbstractProfileInterceptorAction

`doExecute, doExecute, doPreExecute, setLookupStrategy`

### Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction

`doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy`

### Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction

`getActivationCondition, setActivationCondition`

### Methods inherited from class org.opensaml.profile.action.AbstractProfileAction

`doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplier`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### log

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

### storageContextLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,String> storageContextLookupStrategy
Strategy used to determine the storage context.

### storageKeyLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,String> storageKeyLookupStrategy
Strategy used to determine the storage key.

### storageSerializer

@NonnullAfterInit private StorageSerializer<Map<String,Consent>> storageSerializer
Storage serializer.

### storageService

@Nullable private StorageService storageService
Storage service from the `ProfileInterceptorFlowDescriptor`.

### storageContext

@Nullable private String storageContext
Storage context resulting from lookup strategy.

### storageKey

@Nullable private String storageKey
Storage key resulting from lookup strategy.

## Constructor Details

### AbstractConsentStorageAction

public AbstractConsentStorageAction()
Constructor.

## Method Details

### getStorageContextLookupStrategy

@NonnullAfterInit public Function<ProfileRequestContext,String> getStorageContextLookupStrategy()
Get the storage context lookup strategy.

Returns:
  the storage context lookup strategy

### getStorageKeyLookupStrategy

@NonnullAfterInit public Function<ProfileRequestContext,String> getStorageKeyLookupStrategy()
Get the storage key lookup strategy.

Returns:
  the storage key lookup strategy

### getStorageSerializer

@NonnullAfterInit public StorageSerializer<Map<String,Consent>> getStorageSerializer()
Get the storage serializer.

Returns:
  the storage serializer

### setStorageSerializer

public void setStorageSerializer(@Nonnull StorageSerializer<Map<String,Consent>> serializer)
Set the storage serializer.

Parameters:
  `serializer` - storage serializer

### setStorageContextLookupStrategy

public void setStorageContextLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set the storage context lookup strategy.

Parameters:
  `strategy` - the storage context lookup strategy

### setStorageKeyLookupStrategy

public void setStorageKeyLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set the storage key lookup strategy.

Parameters:
  `strategy` - the storage key lookup strategy

### getStorageService

@Nullable public StorageService getStorageService()
Get the storage service from the `ProfileInterceptorFlowDescriptor`.

Returns:
  the storage service

### getStorageContext

@Nullable public String getStorageContext()
Get the storage context resulting from applying the storage context lookup strategy.

Returns:
  the storage context

### getStorageKey

@Nullable public String getStorageKey()
Get the storage key resulting from applying the storage key lookup strategy.

Returns:
  the storage key

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractInitializableComponent`
Throws:
  `ComponentInitializationException`

### doPreExecute

protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull ProfileInterceptorContext interceptorContext)
Performs this profile interceptor action's pre-execute step. Default implementation returns true.

Overrides:
  `doPreExecute` in class `AbstractConsentAction`
Parameters:
  `profileRequestContext` - the current profile request context
  `interceptorContext` - the current profile interceptor context
Returns:
  true iff execution should continue