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

# Class AbstractEncryptAction

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

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

Direct Known Subclasses:
  `EncryptAssertions`, `EncryptAttributes`, `EncryptNameIDs`

public abstract class AbstractEncryptAction extends AbstractConditionalProfileAction
Abstract base class for actions that perform simple unicast SAML encryption to a single decrypting party.

The `EncryptionContext` governing the encryption process is located by a lookup strategy, by default a child of the outbound message context.

An optional recipient name is also obtained from a lookup strategy.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Encrypter`
`encrypter`
The encryption object.
`private Function<ProfileRequestContext,EncryptionContext>`
`encryptionCtxLookupStrategy`
Strategy used to locate the `EncryptionContext`.
`private Predicate<ProfileRequestContext>`
`encryptToSelf`
Predicate used to determine whether to perform encrypt-to-self.
`private Function<Pair<ProfileRequestContext,EncryptionParameters>,List<EncryptionParameters>>`
`encryptToSelfParametersStrategy`
Strategy used to resolve the encrypt-to-self parameters.
`private Function<ProfileRequestContext,Encrypter.KeyPlacement>`
`keyPlacementLookupStrategy`
Strategy used to determine encrypted key placement.
`private final org.slf4j.Logger`
`log`
Class logger.
`private Function<ProfileRequestContext,String>`
`recipientLookupStrategy`
Strategy used to locate the encryption recipient.
`private Function<ProfileRequestContext,String>`
`selfRecipientLookupStrategy`
Strategy used to obtain the self recipient value.

## Constructor Summary

Constructors
Constructor
Description
`AbstractEncryptAction()`
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.
`protected abstract EncryptionParameters`
`getApplicableParameters(EncryptionContext ctx)`
Return the right set of parameters for the operation to be performed, or none if no encryption should occur.
`Encrypter`
`getEncrypter()`
Get the encrypter.
`void`
`setEncryptionContextLookupStrategy(Function<ProfileRequestContext,EncryptionContext> strategy)`
Set the strategy used to locate the `EncryptionContext` associated with a given `ProfileRequestContext`.
`void`
`setEncryptToSelf(Predicate<ProfileRequestContext> predicate)`
Set the predicate used to determine whether to perform encrypt-to-self.
`void`
`setEncryptToSelfParametersStrategy(Function<Pair<ProfileRequestContext,EncryptionParameters>,List<EncryptionParameters>> strategy)`
Set the strategy used to resolve the encrypt-to-self parameters.
`void`
`setKeyPlacementLookupStrategy(Function<ProfileRequestContext,Encrypter.KeyPlacement> strategy)`
Set the strategy used to determine the encrypted key placement strategy.
`void`
`setRecipientLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the encryption recipient.
`void`
`setSelfRecipientLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the self identity value to use.

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

`getActivationCondition, setActivationCondition`

### 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.

### encryptionCtxLookupStrategy

@Nonnull private Function<ProfileRequestContext,EncryptionContext> encryptionCtxLookupStrategy
Strategy used to locate the `EncryptionContext`.

### recipientLookupStrategy

@Nullable private Function<ProfileRequestContext,String> recipientLookupStrategy
Strategy used to locate the encryption recipient.

### keyPlacementLookupStrategy

@Nonnull private Function<ProfileRequestContext,Encrypter.KeyPlacement> keyPlacementLookupStrategy
Strategy used to determine encrypted key placement.

### encryptToSelf

@Nonnull private Predicate<ProfileRequestContext> encryptToSelf
Predicate used to determine whether to perform encrypt-to-self.

### encryptToSelfParametersStrategy

@Nullable private Function<Pair<ProfileRequestContext,EncryptionParameters>,List<EncryptionParameters>> encryptToSelfParametersStrategy
Strategy used to resolve the encrypt-to-self parameters.

### selfRecipientLookupStrategy

@Nullable private Function<ProfileRequestContext,String> selfRecipientLookupStrategy
Strategy used to obtain the self recipient value.

### encrypter

@NonnullBeforeExec private Encrypter encrypter
The encryption object.

## Constructor Details

### AbstractEncryptAction

public AbstractEncryptAction()
Constructor.

## Method Details

### setEncryptionContextLookupStrategy

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

Parameters:
  `strategy` - lookup strategy

### setRecipientLookupStrategy

public void setRecipientLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the encryption recipient.

Parameters:
  `strategy` - lookup strategy

### setKeyPlacementLookupStrategy

public void setKeyPlacementLookupStrategy(@Nonnull Function<ProfileRequestContext,Encrypter.KeyPlacement> strategy)
Set the strategy used to determine the encrypted key placement strategy.

Parameters:
  `strategy` - lookup strategy

### setEncryptToSelf

public void setEncryptToSelf(@Nonnull Predicate<ProfileRequestContext> predicate)
Set the predicate used to determine whether to perform encrypt-to-self.

Parameters:
  `predicate` - the encrypt-to-self predicate

### setEncryptToSelfParametersStrategy

public void setEncryptToSelfParametersStrategy(@Nullable Function<Pair<ProfileRequestContext,EncryptionParameters>,List<EncryptionParameters>> strategy)
Set the strategy used to resolve the encrypt-to-self parameters.

Parameters:
  `strategy` - the encrypt-to-self predicate

### setSelfRecipientLookupStrategy

public void setSelfRecipientLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the self identity value to use.

Parameters:
  `strategy` - lookup strategy

### getEncrypter

@NonnullBeforeExec public Encrypter getEncrypter()
Get the encrypter.

Returns:
  the encrypter

### 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 `AbstractConditionalProfileAction`
Parameters:
  `profileRequestContext` - the current IdP profile request context
Returns:
  true iff execution should proceed

### getApplicableParameters

@Nullable protected abstract EncryptionParameters getApplicableParameters(@Nullable EncryptionContext ctx)
Return the right set of parameters for the operation to be performed, or none if no encryption should occur.

Parameters:
  `ctx` - possibly null input context to pull parameters from
Returns:
  the right parameter set, or null for none