Package net.shibboleth.idp.saml.attribute.transcoding

# Class AbstractSAML2AttributeTranscoder<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<Attribute,EncodedType>
net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML2AttributeTranscoder<EncodedType>

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

All Implemented Interfaces:
  `AttributeTranscoder<Attribute>`, `SAML2AttributeTranscoder<EncodedType>`, `Component`, `DestructableComponent`, `InitializableComponent`

Direct Known Subclasses:
  `SAML2ByteAttributeTranscoder`, `SAML2DateTimeAttributeTranscoder`, `SAML2ScopedStringAttributeTranscoder`, `SAML2StringAttributeTranscoder`, `SAML2XMLObjectAttributeTranscoder`

public abstract class AbstractSAML2AttributeTranscoder<EncodedType extends IdPAttributeValue> extends AbstractSAMLAttributeTranscoder<Attribute,EncodedType> implements SAML2AttributeTranscoder<EncodedType>
Base class for transcoders that operate on a SAML 2 `Attribute` or `RequestedAttribute`.

## Nested Class Summary

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

## Field Summary

Fields
Modifier and Type
Field
Description
`private final SAMLObjectBuilder<Attribute>`
`attributeBuilder`
Builder used to construct `Attribute` objects.
`private final org.slf4j.Logger`
`log`
Class logger.
`private final SAMLObjectBuilder<RequestedAttribute>`
`reqAttributeBuilder`
Builder used to construct `RequestedAttribute` objects.

### Fields inherited from interface net.shibboleth.idp.saml.attribute.transcoding.SAML2AttributeTranscoder

`METADATA_TAG_NAME, PROP_ENCODE_TYPE, PROP_FRIENDLY_NAME, PROP_NAME, PROP_NAME_FORMAT, PROP_NAME_FROM_METADATA`

## Constructor Summary

Constructors
Constructor
Description
`AbstractSAML2AttributeTranscoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected Attribute`
`buildAttribute(ProfileRequestContext profileRequestContext, IdPAttribute attribute, Class<? extends Attribute> to, TranscodingRule rule, List<XMLObject> attributeValues)`
Builds a SAML attribute element from the given attribute values.
`protected IdPAttribute`
`buildIdPAttribute(ProfileRequestContext profileRequestContext, Attribute attribute, TranscodingRule rule, List<IdPAttributeValue> attributeValues)`
Builds an `IdPAttribute` from the given values.
`protected void`
`encodeName(ProfileRequestContext profileRequestContext, IdPAttribute attribute, Attribute samlAttribute, TranscodingRule rule)`
`String`
`getEncodedName(TranscodingRule rule)`
Get the name of the encoded object that would be created by a given set of instructions.
`Class<Attribute>`
`getEncodedType()`
Get the class representing the type of object supported by this transcoder.
`protected Iterable<XMLObject>`
`getValues(Attribute input)`
Returns the values to decode from the concrete input object.

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

`decode, encode`

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

`initialize, isInitialized`

## Field Details

### log

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

### attributeBuilder

@Nonnull private final SAMLObjectBuilder<Attribute> attributeBuilder
Builder used to construct `Attribute` objects.

### reqAttributeBuilder

@Nonnull private final SAMLObjectBuilder<RequestedAttribute> reqAttributeBuilder
Builder used to construct `RequestedAttribute` objects.

## Constructor Details

### AbstractSAML2AttributeTranscoder

public AbstractSAML2AttributeTranscoder()
Constructor.

## Method Details

### getEncodedType

@Nonnull public Class<Attribute> 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 Attribute buildAttribute(@Nullable ProfileRequestContext profileRequestContext, @Nullable IdPAttribute attribute, @Nonnull Class<? extends Attribute> 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<Attribute,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

### encodeName

protected void encodeName(@Nullable ProfileRequestContext profileRequestContext, @Nullable IdPAttribute attribute, @Nonnull Attribute samlAttribute, @Nonnull TranscodingRule rule) throws AttributeEncodingException

Throws:
  `AttributeEncodingException`

### buildIdPAttribute

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

Specified by:
  `buildIdPAttribute` in class `AbstractSAMLAttributeTranscoder<Attribute,EncodedType extends IdPAttributeValue>`
Parameters:
  `profileRequestContext` - current profile request
  `attribute` - 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 Attribute input)
Returns the values to decode from the concrete input object.

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