Package net.shibboleth.idp.saml.saml2.profile.config

# Class AttributeSourcedAuthnContextTranslationStrategy

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.saml.saml2.profile.config.AttributeSourcedAuthnContextTranslationStrategy

All Implemented Interfaces:
  `Function<ProfileRequestContext,Collection<Principal>>`, `Component`, `DestructableComponent`, `InitializableComponent`

public class AttributeSourcedAuthnContextTranslationStrategy extends AbstractInitializableComponent implements Function<ProfileRequestContext,Collection<Principal>>
Implementation of the SSO authnContextTranslationStrategyEx hook that translates decoded `IdPAttribute` values into (optionally mapped) values in the form of `AuthnContextClassRefPrincipal` objects.

This is primarily used for proxying via SAML to non-compliant IdPs (i.e., virtually all of them) that can't be bothered to properly support the use of Authentication Context to carry what it was literally designed to carry.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,AttributeContext>`
`attributeContextLookupStrategy`
Lookup strategy for AttributeContext to pull from.
`private Set<String>`
`attributeSourceIDs`
Attribute sources to pull from.
`private final org.slf4j.Logger`
`log`
Class logger.
`private Map<String,Principal>`
`valueMappings`
Translation map to convert values if necessary.

## Constructor Summary

Constructors
Constructor
Description
`AttributeSourcedAuthnContextTranslationStrategy()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`private void`
`addMappedValues(Set<Principal> results, IdPAttribute source)`
`Collection<Principal>`
`apply(ProfileRequestContext input)`
`void`
`setAttributeContextLookupStrategy(Function<ProfileRequestContext,AttributeContext> strategy)`
Sets the lookup strategy for the `AttributeContext` to pull from.
`void`
`setAttributeSourceIDs(Collection<String> sources)`
Sets the names of the `IdPAttribute` objects to check for values to map in.
`void`
`setMappings(Map<String,Principal> mappings)`
Sets the mappings to transform `StringAttributeValue` data into different values for use as `Principal` objects.
`void`
`setValueMappings(Map<String,String> mappings)`
Deprecated, for removal: This API element is subject to removal in a future version.

### 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 java.util.function.Function

`andThen, compose`

## Field Details

### log

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

### attributeContextLookupStrategy

@Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy
Lookup strategy for AttributeContext to pull from.

### attributeSourceIDs

@Nonnull private Set<String> attributeSourceIDs
Attribute sources to pull from.

### valueMappings

@Nonnull private Map<String,Principal> valueMappings
Translation map to convert values if necessary.

## Constructor Details

### AttributeSourcedAuthnContextTranslationStrategy

public AttributeSourcedAuthnContextTranslationStrategy()
Constructor.

## Method Details

### setAttributeContextLookupStrategy

public void setAttributeContextLookupStrategy(@Nonnull Function<ProfileRequestContext,AttributeContext> strategy)
Sets the lookup strategy for the `AttributeContext` to pull from.

Parameters:
  `strategy` - lookup strategy

### setAttributeSourceIDs

public void setAttributeSourceIDs(@Nonnull Collection<String> sources)
Sets the names of the `IdPAttribute` objects to check for values to map in.

Parameters:
  `sources` - `IdPAttribute` IDs to check for

### setValueMappings

@Deprecated(since="5.2.0", forRemoval=true) public void setValueMappings(@Nullable Map<String,String> mappings)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the mappings to transform `StringAttributeValue` data into different values for use as `AuthnContextClassRefPrincipal` objects.

Note that null keys are ignored, but null values are allowed, which suppresses the mapping of a value caising it to be skipped. Also, keys are not trimmed, but values are, to ensure the result is a valid context class reference.

This is deprecated in favor of the type-neutral variant.

Parameters:
  `mappings` - the value mappings

### setMappings

public void setMappings(@Nullable Map<String,Principal> mappings)
Sets the mappings to transform `StringAttributeValue` data into different values for use as `Principal` objects.

Note that null keys are ignored, but null values are allowed, which suppresses the mapping of a value caising it to be skipped. Also, keys are not trimmed, but values are, to ensure the result is a valid context class reference.

Parameters:
  `mappings` - the value mappings

### apply

@Nullable public Collection<Principal> apply(@Nullable ProfileRequestContext input)

Specified by:
  `apply` in interface `Function<ProfileRequestContext,Collection<Principal>>`

### addMappedValues

private void addMappedValues(@Nonnull Set<Principal> results, @Nonnull IdPAttribute source)