Package org.opensaml.saml.saml2.profile.impl

# Class AbstractDecryptAction

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.saml.saml2.profile.impl.AbstractDecryptAction

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `ProfileAction`

Direct Known Subclasses:
  `DecryptAssertions`, `DecryptAttributes`, `DecryptNameIDs`

public abstract class AbstractDecryptAction extends AbstractProfileAction
Abstract base class for actions that perform SAML decryption.

The actual message to handle is obtained via strategy function, by default the inbound message.

The `SecurityParametersContext` governing the decryption process is located by a lookup strategy, by default a child of the inbound message context.

Event:
  `EventIds.PROCEED_EVENT_ID`, `EventIds.INVALID_MSG_CTX`

## Field Summary

Fields
Modifier and Type
Field
Description
`private Decrypter`
`decrypter`
The decryption object.
`private Predicate<Pair<ProfileRequestContext,EncryptedElementType>>`
`decryptionPredicate`
Predicate determining whether to attempt decryption.
`private boolean`
`errorFatal`
Are decryption failures a fatal condition?
`private final org.slf4j.Logger`
`log`
Class logger.
`private SAMLObject`
`message`
Message to operate on.
`private Function<ProfileRequestContext,Object>`
`messageLookupStrategy`
Strategy used to locate the SAML message to operate on.
`private Function<ProfileRequestContext,SecurityParametersContext>`
`securityParamsLookupStrategy`
Strategy used to locate the `SecurityParametersContext`.

## Constructor Summary

Constructors
Constructor
Description
`AbstractDecryptAction()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`doPreExecute(ProfileRequestContext profileRequestContext)`
Called prior to execution, actions may override this method to perform pre-processing for a request.
`Decrypter`
`getDecrypter()`
Get the decrypter.
`Predicate<Pair<ProfileRequestContext,EncryptedElementType>>`
`getDecryptionPredicate()`
Get the predicate used to determine whether to attempt decryption.
`SAMLObject`
`getSAMLObject()`
Get the object to act on.
`boolean`
`isErrorFatal()`
Get whether decryption failure should be treated as an error or ignored.
`void`
`setDecryptionPredicate(Predicate<Pair<ProfileRequestContext,EncryptedElementType>> predicate)`
Set the predicate used to determine whether to attempt decryption.
`void`
`setErrorFatal(boolean flag)`
Set whether decryption failure should be treated as an error or ignored.
`void`
`setMessageLookupStrategy(Function<ProfileRequestContext,Object> strategy)`
Set the strategy used to locate the `SAMLObject` to operate on.
`void`
`setSecurityParametersContextLookupStrategy(Function<ProfileRequestContext,SecurityParametersContext> strategy)`
Set the strategy used to locate the `SecurityParametersContext` associated with a given `ProfileRequestContext`.

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

`doExecute, 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, doInitialize, 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.

### errorFatal

private boolean errorFatal
Are decryption failures a fatal condition?

### securityParamsLookupStrategy

@Nonnull private Function<ProfileRequestContext,SecurityParametersContext> securityParamsLookupStrategy
Strategy used to locate the `SecurityParametersContext`.

### messageLookupStrategy

@Nonnull private Function<ProfileRequestContext,Object> messageLookupStrategy
Strategy used to locate the SAML message to operate on.

### decryptionPredicate

@Nonnull private Predicate<Pair<ProfileRequestContext,EncryptedElementType>> decryptionPredicate
Predicate determining whether to attempt decryption.

### decrypter

@Nullable private Decrypter decrypter
The decryption object.

### message

@NonnullBeforeExec private SAMLObject message
Message to operate on.

## Constructor Details

### AbstractDecryptAction

public AbstractDecryptAction()
Constructor.

## Method Details

### isErrorFatal

public boolean isErrorFatal()
Get whether decryption failure should be treated as an error or ignored.

Returns:
  whether decryption failure should be treated as an error or ignored

### setErrorFatal

public void setErrorFatal(boolean flag)
Set whether decryption failure should be treated as an error or ignored.

Parameters:
  `flag` - true iff decryption failure should be fatal

### setSecurityParametersContextLookupStrategy

public void setSecurityParametersContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SecurityParametersContext> strategy)
Set the strategy used to locate the `SecurityParametersContext` associated with a given `ProfileRequestContext`.

Parameters:
  `strategy` - strategy used to locate the `SecurityParametersContext` associated with a given `ProfileRequestContext`

### setMessageLookupStrategy

public void setMessageLookupStrategy(@Nonnull Function<ProfileRequestContext,Object> strategy)
Set the strategy used to locate the `SAMLObject` to operate on.

Parameters:
  `strategy` - strategy used to locate the `SAMLObject` to operate on

### getDecryptionPredicate

@Nonnull public Predicate<Pair<ProfileRequestContext,EncryptedElementType>> getDecryptionPredicate()
Get the predicate used to determine whether to attempt decryption.

Returns:
  the predicate

### setDecryptionPredicate

public void setDecryptionPredicate(@Nonnull Predicate<Pair<ProfileRequestContext,EncryptedElementType>> predicate)
Set the predicate used to determine whether to attempt decryption.

Parameters:
  `predicate` - predicate to use

### getDecrypter

@Nullable public Decrypter getDecrypter()
Get the decrypter.

Returns:
  the decrypter

### getSAMLObject

@NonnullBeforeExec public SAMLObject getSAMLObject()
Get the object to act on.

Returns:
  the object to act on

### doPreExecute

protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)
Called prior to execution, actions may override this method to perform pre-processing for a request.

If false is returned, execution will not proceed, and the action should attach an `EventContext` to the context tree to signal how to continue with overall workflow processing.

If returning successfully, the last step should be to return the result of the superclass version of this method.

Overrides:
  `doPreExecute` in class `AbstractProfileAction`
Parameters:
  `profileRequestContext` - the current IdP profile request context
Returns:
  true iff execution should proceed