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

# Class ContextDerivedDataConnector

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.ContextDerivedDataConnector

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

public class ContextDerivedDataConnector extends AbstractDataConnector
A data connector which returns attributes whose values are derived from the `ProfileRequestContext` associated with the request via a plugged in `Function`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,List<IdPAttribute>>`
`attributesFunction`
Function used to generate the attributes derived from the `ProfileRequestContext`.
`private final org.slf4j.Logger`
`log`
Logger.
`private boolean`
`noResultIsError`
Whether no record is an error.

## Constructor Summary

Constructors
Constructor
Description
`ContextDerivedDataConnector()`

## 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()`
`Function<ProfileRequestContext,List<IdPAttribute>>`
`getAttributesFunction()`
Gets the attribute derivation function.
`boolean`
`isNoResultIsError()`
Gets whether the lack of returned attributes constitutes an error.
`void`
`setAttributesFunction(Function<ProfileRequestContext,List<IdPAttribute>> function)`
Sets the attribute derivation function.
`void`
`setNoResultIsError(boolean flag)`
Sets whether the lack of a returned record constitutes an error.

### 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
Logger.

### attributesFunction

@NonnullAfterInit private Function<ProfileRequestContext,List<IdPAttribute>> attributesFunction
Function used to generate the attributes derived from the `ProfileRequestContext`.

### noResultIsError

private boolean noResultIsError
Whether no record is an error.

## Constructor Details

### ContextDerivedDataConnector

public ContextDerivedDataConnector()

## Method Details

### getAttributesFunction

@NonnullAfterInit public Function<ProfileRequestContext,List<IdPAttribute>> getAttributesFunction()
Gets the attribute derivation function.

Returns:
  derivation function

### setAttributesFunction

public void setAttributesFunction(@Nonnull Function<ProfileRequestContext,List<IdPAttribute>> function)
Sets the attribute derivation function.

Parameters:
  `function` - what to set.

### isNoResultIsError

public boolean isNoResultIsError()
Gets whether the lack of returned attributes constitutes an error.

Returns:
  whether the lack of returned attributes constitutes an error

### setNoResultIsError

public void setNoResultIsError(boolean flag)
Sets whether the lack of a returned record constitutes an error.

Parameters:
  `flag` - flag to set

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### doDataConnectorResolve

@Nullable @Unmodifiable @NotLive 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