Package net.shibboleth.idp.saml.saml1.profile.impl

# Class AddAttributeStatementToAssertion

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.saml.profile.impl.BaseAddAttributeStatementToAssertion<Attribute>
net.shibboleth.idp.saml.saml1.profile.impl.AddAttributeStatementToAssertion

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

public class AddAttributeStatementToAssertion extends BaseAddAttributeStatementToAssertion<Attribute>
Action that builds an `AttributeStatement` and adds it to an `Assertion` returned by a lookup strategy, by default in the `InOutOperationContext.getOutboundMessageContext()`.

If no `Response` exists, then an `Assertion` directly in the outbound message context will be used or created

The `IdPAttribute` set to be encoded is drawn from an `AttributeContext` returned from a lookup strategy, by default located on the `RelyingPartyContext` beneath the profile request context.

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

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private final class`
`AddAttributeStatementToAssertion.AssertionStrategy`
Default strategy for obtaining assertion to modify.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,Assertion>`
`assertionLookupStrategy`
Strategy used to locate the `Assertion` to operate on.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`AddAttributeStatementToAssertion()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`private AttributeStatement`
`buildAttributeStatement(ProfileRequestContext profileRequestContext, Collection<IdPAttribute> attributes)`
Builds an attribute statement from a collection of attributes.
`protected void`
`doExecute(ProfileRequestContext profileRequestContext)`
`private void`
`encodeAttribute(AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, IdPAttribute attribute, Collection<Attribute> results)`
Encodes `IdPAttribute` into zero or more `Attribute` objects if a proper encoder is available.
`private Attribute`
`findExistingAttribute(AttributeStatement statement, Attribute newAttribute)`
Find a matching `Attribute` in the statement, if any.
`void`
`setAssertionLookupStrategy(Function<ProfileRequestContext,Assertion> strategy)`
Set the strategy used to locate the `Assertion` to operate on.

### Methods inherited from class net.shibboleth.idp.saml.profile.impl.BaseAddAttributeStatementToAssertion

`doInitialize, doPreExecute, encodeAttribute, getAttributesToEncode, getIdGenerator, getIssuerId, getTranscoderRegistry, isIgnoringUnencodableAttributes, isStatementInOwnAssertion, setAttributeContextLookupStrategy, setIdentifierGeneratorLookupStrategy, setIgnoringUnencodableAttributes, setIssuerLookupStrategy, setStatementInOwnAssertion, setTranscoderRegistry, setUseUnfilteredAttributesPredicate`

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

### assertionLookupStrategy

@Nonnull private Function<ProfileRequestContext,Assertion> assertionLookupStrategy
Strategy used to locate the `Assertion` to operate on.

## Constructor Details

### AddAttributeStatementToAssertion

public AddAttributeStatementToAssertion()
Constructor.

## Method Details

### setAssertionLookupStrategy

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

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

### doExecute

protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)

Overrides:
  `doExecute` in class `AbstractProfileAction`

### buildAttributeStatement

@Nullable private AttributeStatement buildAttributeStatement(@Nonnull ProfileRequestContext profileRequestContext, @Nullable @NullableElements Collection<IdPAttribute> attributes) throws AttributeEncodingException
Builds an attribute statement from a collection of attributes.

Parameters:
  `profileRequestContext` - current profile request context
  `attributes` - the collection of attributes
Returns:
  the attribute statement or null if no attributes can be encoded
Throws:
  `AttributeEncodingException` - thrown if there is a problem encoding an attribute

### findExistingAttribute

@Nullable private Attribute findExistingAttribute(@Nonnull AttributeStatement statement, @Nonnull Attribute newAttribute)
Find a matching `Attribute` in the statement, if any.

Parameters:
  `statement` - input statement
  `newAttribute` - the attribute to match
Returns:
  a match, or null

### encodeAttribute

private void encodeAttribute(@Nonnull AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull Collection<Attribute> results) throws AttributeEncodingException
Encodes `IdPAttribute` into zero or more `Attribute` objects if a proper encoder is available.

Parameters:
  `registry` - transcoding registry
  `profileRequestContext` - current profile request context
  `attribute` - the attribute to be encoded
  `results` - collection to add the encoded SAML attributes to
Throws:
  `AttributeEncodingException` - thrown if there is a problem encoding an attribute