Package net.shibboleth.idp.attribute.resolver.dc.saml.impl

# Class BasicResponseMappingStrategy

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.saml.impl.BasicResponseMappingStrategy

All Implemented Interfaces:
  `MappingStrategy<ResponseData>`, `ResponseMappingStrategy`, `Component`, `DestructableComponent`, `InitializableComponent`

public class BasicResponseMappingStrategy extends AbstractInitializableComponent implements ResponseMappingStrategy
Basic SAML 2 Response strategy to map to data connector output requirements.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`filterAttributes`
Flag indicating whether to filter attributes.
`private ReloadableService<AttributeFilter>`
`filterService`
AttributeFilter service.
`private final org.slf4j.Logger`
`log`
Logger.
`private MetadataResolver`
`metadataResolver`
MetadataResolver.
`private RoleDescriptorResolver`
`roleDescriptorResolver`
Role descriptor resolver.
`private ReloadableService<AttributeTranscoderRegistry>`
`transcoderService`
AttributeTranscoderRegistry service.

## Constructor Summary

Constructors
Constructor
Description
`BasicResponseMappingStrategy()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`private Collection<IdPAttribute>`
`filterAssertionResults(List<IdPAttribute> assertionResults, String assertionIssuerID, ProfileRequestContext profileContext, ResponseData responseData)`
Filter the decoded attributes from an Assertion.
`ReloadableService<AttributeFilter>`
`getAttributeFilterService()`
Get the instance of `AttributeFilter` service to use.
`MetadataResolver`
`getMetadataResolver()`
Get the instance of `MetadataResolver` to use.
`RoleDescriptorResolver`
`getRoleDescriptorResolver()`
Get the role descriptor resolver.
`ReloadableService<AttributeTranscoderRegistry>`
`getTranscoderService()`
Get the instance of `AttributeTranscoderRegistry` service to use.
`boolean`
`isFilterAttributes()`
Get the flag indicating whether to filter attributes.
`Map<String,IdPAttribute>`
`map(ResponseData responseData)`
Maps the given results to a collection of `IdPAttribute` indexed by the attribute's ID.
`private void`
`populateFilterContext(AttributeFilterContext filterContext, Map<String,IdPAttribute> unfilteredAttributes, String assertionIssuer, ResponseData responseData)`
Populate the `AttributeFilterContext` for processing.
`private Collection<IdPAttribute>`
`processAssertionFiltering(Assertion assertion, List<IdPAttribute> assertionResults, String assertionIssuerID, ProfileRequestContext profileContext, ResponseData responseData)`
Process filtering the attributes of an Assertion.
`private AttributeAuthorityDescriptor`
`resolveAuthorityRoleDescriptor(String authorityEntityID)`
Resolve the attribute authority role descriptor.
`private SAMLMetadataContext`
`resolveIssuerMetadataContext(ResponseData responseData, String assertionIssuer)`
Resolve the `SAMLMetadataContext` for the assertion issuer.
`private SAMLPeerEntityContext`
`resolvePeerEntityContext(ResponseData responseData)`
Resolve the response issuer's `SAMLPeerEntityContext`.
`private String`
`resolveSelfEntityID(ResponseData responseData)`
Resolve the self entityID used for the original attribute query.
`void`
`setAttributeFilterService(ReloadableService<AttributeFilter> service)`
Set the instance of `AttributeFilter` service to use.
`void`
`setFilterAttributes(boolean flag)`
Set the flag indicating whether to filter attributes.
`void`
`setMetadataResolver(MetadataResolver resolver)`
Set the instance of `MetadataResolver` to use.
`void`
`setRoleDescriptorResolver(RoleDescriptorResolver resolver)`
Set the role descriptor resolver.
`void`
`setTranscoderService(ReloadableService<AttributeTranscoderRegistry> service)`
Set the instance of `AttributeTranscoderRegistry` service to use.
`private List<IdPAttribute>`
`transcodeAttribute(Attribute samlAttribute, ProfileRequestContext profileContext)`
Transcode a specified `Attribute` into a list of `IdPAttribute`.

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

## Field Details

### log

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

### transcoderService

@NonnullAfterInit private ReloadableService<AttributeTranscoderRegistry> transcoderService
AttributeTranscoderRegistry service.

### metadataResolver

@NonnullAfterInit private MetadataResolver metadataResolver
MetadataResolver.

### roleDescriptorResolver

@NonnullAfterInit private RoleDescriptorResolver roleDescriptorResolver
Role descriptor resolver.

### filterService

@NonnullAfterInit private ReloadableService<AttributeFilter> filterService
AttributeFilter service.

### filterAttributes

private boolean filterAttributes
Flag indicating whether to filter attributes.

## Constructor Details

### BasicResponseMappingStrategy

public BasicResponseMappingStrategy()

## Method Details

### getTranscoderService

@NonnullAfterInit public ReloadableService<AttributeTranscoderRegistry> getTranscoderService()
Get the instance of `AttributeTranscoderRegistry` service to use.

Returns:
  the transcoder registry service

### setTranscoderService

public void setTranscoderService(@Nullable ReloadableService<AttributeTranscoderRegistry> service)
Set the instance of `AttributeTranscoderRegistry` service to use.

Parameters:
  `service` - the transcoder registry service

### getMetadataResolver

@NonnullAfterInit public MetadataResolver getMetadataResolver()
Get the instance of `MetadataResolver` to use.

Returns:
  the metadata resolver

### setMetadataResolver

public void setMetadataResolver(@Nullable MetadataResolver resolver)
Set the instance of `MetadataResolver` to use.

Parameters:
  `resolver` - the metadata resolver

### getRoleDescriptorResolver

@NonnullAfterInit public RoleDescriptorResolver getRoleDescriptorResolver()
Get the role descriptor resolver.

Returns:
  the role descriptor resolver

### setRoleDescriptorResolver

public void setRoleDescriptorResolver(@Nullable RoleDescriptorResolver resolver)
Set the role descriptor resolver.

Parameters:
  `resolver` - the role descriptor resolver

### getAttributeFilterService

public ReloadableService<AttributeFilter> getAttributeFilterService()
Get the instance of `AttributeFilter` service to use.

Returns:
  the attribute filter service

### setAttributeFilterService

public void setAttributeFilterService(@Nullable ReloadableService<AttributeFilter> service)
Set the instance of `AttributeFilter` service to use.

Parameters:
  `service` - the attribute filter service

### isFilterAttributes

public boolean isFilterAttributes()
Get the flag indicating whether to filter attributes.

Returns:
  true if attributes should be filter, otherwise false

### setFilterAttributes

public void setFilterAttributes(boolean flag)
Set the flag indicating whether to filter attributes.

Parameters:
  `flag` - true if attributes should be filter, otherwise false

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### map

@Nullable public Map<String,IdPAttribute> map(@Nonnull ResponseData responseData) throws ResolutionException
Maps the given results to a collection of `IdPAttribute` indexed by the attribute's ID.

Specified by:
  `map` in interface `MappingStrategy<ResponseData>`
Parameters:
  `responseData` - to map
Returns:
  the mapped attributes or null if none exist
Throws:
  `ResolutionException` - thrown if there is a problem reading data or mapping it

### transcodeAttribute

@Nonnull private List<IdPAttribute> transcodeAttribute(@Nonnull Attribute samlAttribute, @Nullable ProfileRequestContext profileContext)
Transcode a specified `Attribute` into a list of `IdPAttribute`.

Parameters:
  `samlAttribute` - the SAML Attribute to transcode
  `profileContext` - the profile request context being processed, if available
Returns:
  collection of transcoded attributes

### processAssertionFiltering

@Nonnull private Collection<IdPAttribute> processAssertionFiltering(@Nonnull Assertion assertion, @Nonnull List<IdPAttribute> assertionResults, @Nullable String assertionIssuerID, @Nullable ProfileRequestContext profileContext, @Nonnull ResponseData responseData)
Process filtering the attributes of an Assertion.

Parameters:
  `assertion` - the assertion being processed
  `assertionResults` - the decoded attributes of an Assertion
  `assertionIssuerID` - the Assertion issuer ID
  `profileContext` - the profile request being processed
  `responseData` - the Response data being processed
Returns:
  the results of filtering for the assertion's attributes

### filterAssertionResults

@Nonnull private Collection<IdPAttribute> filterAssertionResults(@Nonnull List<IdPAttribute> assertionResults, @Nonnull String assertionIssuerID, @Nonnull ProfileRequestContext profileContext, @Nonnull ResponseData responseData)
Filter the decoded attributes from an Assertion.

Parameters:
  `assertionResults` - the decoded attributes of an Assertion
  `assertionIssuerID` - the Assertion issuer ID
  `profileContext` - the profile request being processed
  `responseData` - the Response data being processed
Returns:
  the filtered attributes

### populateFilterContext

private void populateFilterContext(@Nonnull AttributeFilterContext filterContext, @Nonnull Map<String,IdPAttribute> unfilteredAttributes, @Nonnull String assertionIssuer, @Nonnull ResponseData responseData)
Populate the `AttributeFilterContext` for processing.

Parameters:
  `filterContext` - the filter context to populate
  `unfilteredAttributes` - the unfiltered attributes
  `assertionIssuer` - issuer of the Assertion being processed
  `responseData` - the response data being processed

### resolveSelfEntityID

@Nullable private String resolveSelfEntityID(@Nonnull ResponseData responseData)
Resolve the self entityID used for the original attribute query.

Parameters:
  `responseData` - the response data being processed
Returns:
  the self entityID

### resolveIssuerMetadataContext

@Nonnull private SAMLMetadataContext resolveIssuerMetadataContext(@Nonnull ResponseData responseData, @Nonnull String assertionIssuer)
Resolve the `SAMLMetadataContext` for the assertion issuer.

Parameters:
  `responseData` - the response data being processed
  `assertionIssuer` - issuer of the Assertion being processed
Returns:
  the resolved SAMLMetadataContext instance

### resolvePeerEntityContext

@Nonnull private SAMLPeerEntityContext resolvePeerEntityContext(@Nonnull ResponseData responseData)
Resolve the response issuer's `SAMLPeerEntityContext`.

Parameters:
  `responseData` - the response data being processed
Returns:
  the self entityID

### resolveAuthorityRoleDescriptor

@Nullable private AttributeAuthorityDescriptor resolveAuthorityRoleDescriptor(@Nonnull String authorityEntityID)
Resolve the attribute authority role descriptor.

Parameters:
  `authorityEntityID` - the entityID of the attribute authority being processed
Returns:
  the the role descriptor of the attribute authority being processed, or null if not available