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

# Class SAMLAttributeDataConnector

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<Map<String,IdPAttribute>>
net.shibboleth.idp.attribute.resolver.AbstractDataConnector
net.shibboleth.idp.attribute.resolver.dc.impl.testing.SAMLAttributeDataConnector

All Implemented Interfaces:
  `DataConnector`, `ResolverPlugin<Map<String,IdPAttribute>>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`, `DisposableBean`

public class SAMLAttributeDataConnector extends AbstractDataConnector
Data Connector to extra attributes from a saml2 `Assertion`. It is hoped that this connector will eventually end up being used in mainline operation, which is why the code looks more suitable for being plugged into a webflow than into a test.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<AttributeResolutionContext,List<Attribute>>`
`attributesStrategy`
The way to get the list of (SAML) attributes from the resolution context.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`SAMLAttributeDataConnector()`

## Method Summary

Modifier and Type
Method
Description
`protected Map<String,IdPAttribute>`
`doDataConnectorResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Retrieves a collection of attributes from some data source.
`protected void`
`doInitialize()`
`private IdPAttributeValue`
`encodeString(XSString inputString)`
Encode a string into an attribute value.
`protected IdPAttributeValue`
`encodeValue(XMLObject object)`
Method to convert a singled `XMLObject` into an `IdPAttributeValue` if possible.
`protected List<IdPAttributeValue>`
`encodeValues(List<XMLObject> attributeValues)`
Encode a list of SAML objects as set of `IdPAttributeValue`.
`Function<AttributeResolutionContext,List<Attribute>>`
`getAttributesStrategy()`
Gets the strategy for finding the (SAML) Attributes from the resolution context.
`void`
`setAttributesStrategy(Function<AttributeResolutionContext,List<Attribute>> strategy)`
Sets the strategy for finding the(SAML) Attributes from the resolution context.

### Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractDataConnector

`doResolve, getExportAttributes, getFailoverDataConnectorId, getLastFail, getLastSuccess, getLogPrefix, getNoRetryDelay, setExportAttributes, setFailoverDataConnectorId, setLastFail, setLastSuccess, setNoRetryDelay`

### Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin

`doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setPropagateResolutionExceptions`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

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

`destroy, isDestroyed`

### Methods inherited from interface org.springframework.beans.factory.DisposableBean

`destroy`

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

`getId`

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

`initialize, isInitialized`

### Methods inherited from interface net.shibboleth.idp.attribute.resolver.ResolverPlugin

`getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, isPropagateResolutionExceptions, resolve`

## Field Details

### log

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

### attributesStrategy

@NonnullAfterInit private Function<AttributeResolutionContext,List<Attribute>> attributesStrategy
The way to get the list of (SAML) attributes from the resolution context.

## Constructor Details

### SAMLAttributeDataConnector

public SAMLAttributeDataConnector()

## Method Details

### getAttributesStrategy

@NonnullAfterInit public Function<AttributeResolutionContext,List<Attribute>> getAttributesStrategy()
Gets the strategy for finding the (SAML) Attributes from the resolution context.

Returns:
  the required strategy.

### setAttributesStrategy

public void setAttributesStrategy(Function<AttributeResolutionContext,List<Attribute>> strategy)
Sets the strategy for finding the(SAML) Attributes from the resolution context.

Parameters:
  `strategy` - to set.

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### encodeValue

@Nullable protected IdPAttributeValue encodeValue(XMLObject object)
Method to convert a singled `XMLObject` into an `IdPAttributeValue` if possible. For testing this is hard-wired - strings become scoped or non scoped (with the scope delimiter being '@'), everything else an `XMLObjectAttributeValue`

Parameters:
  `object` - the object to encode
Returns:
  an `IdPAttributeValue`, or null if no encoding exists.

### encodeString

@Nonnull private IdPAttributeValue encodeString(@Nonnull XSString inputString)
Encode a string into an attribute value.

Parameters:
  `inputString` - string to encode
Returns:
  encoded attribute value

### encodeValues

@Nonnull @Live protected List<IdPAttributeValue> encodeValues(List<XMLObject> attributeValues)
Encode a list of SAML objects as set of `IdPAttributeValue`.

Parameters:
  `attributeValues` - the input values
Returns:
  a list of values, Possibly empty.

### doDataConnectorResolve

@Nullable protected Map<String,IdPAttribute> doDataConnectorResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
Retrieves a collection of attributes from some data source.

Specified by:
  `doDataConnectorResolve` in class `AbstractDataConnector`
Parameters:
  `resolutionContext` - current resolution context
  `workContext` - current resolver work context
Returns:
  collected attributes indexed by attribute ID
Throws:
  `ResolutionException` - thrown if there is a problem resolving the attributes