Package net.shibboleth.idp.saml.saml2.nameid.transcoding

# Class AbstractSAML2NameIDTranscoder<EncodedType extends IdPAttributeValue>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<AttributeType>
net.shibboleth.idp.saml.attribute.transcoding.AbstractSAMLAttributeTranscoder<NameID,EncodedType>
net.shibboleth.idp.saml.saml2.nameid.transcoding.AbstractSAML2NameIDTranscoder<EncodedType>

Type Parameters:
  `EncodedType` - the type of data that can be handled by the transcoder

All Implemented Interfaces:
  `AttributeTranscoder<NameID>`, `SAML2NameIDTranscoder<EncodedType>`, `Component`, `DestructableComponent`, `InitializableComponent`

Direct Known Subclasses:
  `SAML2ScopedStringNameIDTranscoder`, `SAML2StringNameIDTranscoder`

public abstract class AbstractSAML2NameIDTranscoder<EncodedType extends IdPAttributeValue> extends AbstractSAMLAttributeTranscoder<NameID,EncodedType> implements SAML2NameIDTranscoder<EncodedType>
Base class for transcoders that operate on a SAML 2 `NameID`.

For the moment, these are decode only, as the encoding side was already handled with a dedicated generation service. The registry concept came later.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`AbstractSAML2NameIDTranscoder.NamingFunction`
A function to produce a "canonical" name for a SAML 2.0 `NameID` for transcoding rules.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,String>`
`identityProviderNameLookupStrategy`
Function used to obtain the issuer ID.
`private Function<ProfileRequestContext,String>`
`serviceProviderNameLookupStrategy`
Function used to obtain the requester ID.

### Fields inherited from interface net.shibboleth.idp.saml.saml2.nameid.transcoding.SAML2NameIDTranscoder

`PROP_DEFAULT_QUALIFIERS, PROP_NAME_FORMAT`

## Constructor Summary

Constructors
Constructor
Description
`AbstractSAML2NameIDTranscoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected NameID`
`buildAttribute(ProfileRequestContext profileRequestContext, IdPAttribute attribute, Class<? extends NameID> to, TranscodingRule rule, List<XMLObject> attributeValues)`
Builds a SAML attribute element from the given attribute values.
`protected IdPAttribute`
`buildIdPAttribute(ProfileRequestContext profileRequestContext, NameID nameID, TranscodingRule rule, List<IdPAttributeValue> attributeValues)`
Builds an `IdPAttribute` from the given values.
`protected void`
`doInitialize()`
`String`
`getEncodedName(TranscodingRule rule)`
Get the name of the encoded object that would be created by a given set of instructions.
`Class<NameID>`
`getEncodedType()`
Get the class representing the type of object supported by this transcoder.
`protected String`
`getNameQualifier(ProfileRequestContext profileRequestContext, NameID input, boolean useDefaultQualifier)`
Compute the effective NameQualifier to use based on both the input and the transaction.
`protected String`
`getSPNameQualifier(ProfileRequestContext profileRequestContext, NameID input, boolean useDefaultQualifier)`
Compute the effective SPNameQualifier to use based on both the input and the transaction.
`protected Iterable<XMLObject>`
`getValues(NameID input)`
Returns the values to decode from the concrete input object.
`void`
`setIdentityProviderNameLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the name of the identity provider in this transaction.
`void`
`setServiceProviderNameLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the name of the service provider in this transaction.

### Methods inherited from class net.shibboleth.idp.saml.attribute.transcoding.AbstractSAMLAttributeTranscoder

`canEncodeValue, decodeValue, doDecode, doEncode, encodeValue, getStringValue`

### Methods inherited from class net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder

`decode, encode, getNameFromMetadata, setActivationCondition, setNameFromMetadataLookupStrategy`

### 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.idp.attribute.transcoding.AttributeTranscoder

`decode, encode`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### serviceProviderNameLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,String> serviceProviderNameLookupStrategy
Function used to obtain the requester ID.

### identityProviderNameLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,String> identityProviderNameLookupStrategy
Function used to obtain the issuer ID.

## Constructor Details

### AbstractSAML2NameIDTranscoder

public AbstractSAML2NameIDTranscoder()
Constructor.

## Method Details

### setServiceProviderNameLookupStrategy

public void setServiceProviderNameLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the name of the service provider in this transaction.

Parameters:
  `strategy` - lookup strategy

### setIdentityProviderNameLookupStrategy

public void setIdentityProviderNameLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the name of the identity provider in this transaction.

Parameters:
  `strategy` - lookup strategy

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### getEncodedType

@Nonnull public Class<NameID> getEncodedType()
Get the class representing the type of object supported by this transcoder.

Specified by:
  `getEncodedType` in interface `AttributeTranscoder<EncodedType extends IdPAttributeValue>`
Returns:
  object type supported

### getEncodedName

@Nullable public String getEncodedName(@Nonnull TranscodingRule rule)
Get the name of the encoded object that would be created by a given set of instructions.

Specified by:
  `getEncodedName` in interface `AttributeTranscoder<EncodedType extends IdPAttributeValue>`
Parameters:
  `rule` - properties governing the encoding process
Returns:
  a canonical name for objects produced by this transcoder for the given instructions

### buildAttribute

@Nonnull protected NameID buildAttribute(@Nullable ProfileRequestContext profileRequestContext, @Nullable IdPAttribute attribute, @Nonnull Class<? extends NameID> to, @Nonnull TranscodingRule rule, @Nonnull List<XMLObject> attributeValues) throws AttributeEncodingException
Builds a SAML attribute element from the given attribute values.

Specified by:
  `buildAttribute` in class `AbstractSAMLAttributeTranscoder<NameID,EncodedType extends IdPAttributeValue>`
Parameters:
  `profileRequestContext` - current profile request
  `attribute` - the attribute being encoded
  `to` - target type to create
  `rule` - properties to control encoding
  `attributeValues` - the encoded values for the attribute
Returns:
  the SAML attribute object
Throws:
  `AttributeEncodingException` - thrown if there is a problem constructing the SAML attribute

### buildIdPAttribute

@Nonnull protected IdPAttribute buildIdPAttribute(@Nullable ProfileRequestContext profileRequestContext, @Nonnull NameID nameID, @Nonnull TranscodingRule rule, @Nonnull List<IdPAttributeValue> attributeValues) throws AttributeDecodingException
Builds an `IdPAttribute` from the given values.

Specified by:
  `buildIdPAttribute` in class `AbstractSAMLAttributeTranscoder<NameID,EncodedType extends IdPAttributeValue>`
Parameters:
  `profileRequestContext` - current profile request
  `nameID` - the attribute being decoded
  `rule` - properties to control decoding
  `attributeValues` - the decoded values for the attribute
Returns:
  the IdPAttribute object
Throws:
  `AttributeDecodingException` - thrown if there is a problem constructing the IdPAttribute

### getValues

@Nonnull protected Iterable<XMLObject> getValues(@Nonnull NameID input)
Returns the values to decode from the concrete input object.

Specified by:
  `getValues` in class `AbstractSAMLAttributeTranscoder<NameID,EncodedType extends IdPAttributeValue>`
Parameters:
  `input` - input object
Returns:
  values to decode

### getNameQualifier

@Nonnull protected String getNameQualifier(@Nullable ProfileRequestContext profileRequestContext, @Nonnull NameID input, boolean useDefaultQualifier)
Compute the effective NameQualifier to use based on both the input and the transaction.

Parameters:
  `profileRequestContext` - profile request context
  `input` - input object
  `useDefaultQualifier` - true iff the qualifier should be defaulted in if not set
Returns:
  the effective NameQualifier to use

### getSPNameQualifier

@Nonnull protected String getSPNameQualifier(@Nullable ProfileRequestContext profileRequestContext, @Nonnull NameID input, boolean useDefaultQualifier)
Compute the effective SPNameQualifier to use based on both the input and the transaction.

Parameters:
  `profileRequestContext` - profile request context
  `input` - input object
  `useDefaultQualifier` - true iff the qualifier should be defaulted in if not set
Returns:
  the effective NameQualifier to use