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

# Class DependencyAttributeSubjectResolver

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.saml.plugin.impl.DependencyAttributeSubjectResolver

All Implemented Interfaces:
  `SubjectResolver`, `Component`, `DestructableComponent`, `InitializableComponent`

public class DependencyAttributeSubjectResolver extends AbstractInitializableComponent implements SubjectResolver
An implementation of `SubjectResolver` which returns a `Subject` using a `NameID` built using the value from one of an ordered list of dependency attributes.

Dependency attributes are searched in the order specified and the first one found to have a value of a supported type will be used. Supported types are:

- `StringAttributeValue`
- `ScopedStringAttributeValue`
- `XMLObjectAttributeValue` containing a `NameID`

## Field Summary

Fields
Modifier and Type
Field
Description
`private List<String>`
`attributeIDs`
List of dependency attribute IDs to search for a value.
`private String`
`defaultNameIDFormat`
The default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.
`private final org.slf4j.Logger`
`log`
Logger.
`private Map<String,String>`
`nameIDFormatMap`
Map allowing to customize the NameID format URI on a per-attributeID basis.

## Constructor Summary

Constructors
Constructor
Description
`DependencyAttributeSubjectResolver()`

## Method Summary

Modifier and Type
Method
Description
`private Subject`
`buildSubject(String value, String attributeID)`
Build a Subject using the specified string as the NameID value.
`private Subject`
`buildSubject(NameID value)`
Build a Subject using the specified NameID.
`private String`
`determinieNameIDFormat(String attributeID)`
Determine the NamedID Format to use for the given dependency attribute ID.
`List<String>`
`getAttributeIDs()`
Get the list of dependency attribute IDs to search for a value.
`String`
`getDefaultNameIDFormat()`
Get the default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.
`Map<String,String>`
`getNameIDFormatMap()`
Get the map allowing to customize the NameID format URI on a per-attributeID basis.
`Subject`
`resolve(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes, AttributeAuthorityDescriptor roleDescriptor)`
Resolve the `Subject` to use in query.
`void`
`setAttributeIDs(List<String> values)`
Set the list of dependency attribute IDs to search for a value.
`void`
`setDefaultNameIDFormat(String uri)`
Set the default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.
`void`
`setNameIDFormatMap(Map<String,String> formatMap)`
Set the map allowing to customize the NameID format URI on a per-attributeID basis.

### 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`

## Field Details

### log

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

### attributeIDs

@Nonnull private List<String> attributeIDs
List of dependency attribute IDs to search for a value.

### nameIDFormatMap

@Nonnull private Map<String,String> nameIDFormatMap
Map allowing to customize the NameID format URI on a per-attributeID basis.

### defaultNameIDFormat

@Nullable private String defaultNameIDFormat
The default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.

## Constructor Details

### DependencyAttributeSubjectResolver

public DependencyAttributeSubjectResolver()

## Method Details

### getAttributeIDs

@Unmodifiable @NotLive @Nonnull public List<String> getAttributeIDs()
Get the list of dependency attribute IDs to search for a value.

Returns:
  the list of attribute IDs, may be empty

### setAttributeIDs

public void setAttributeIDs(@Nullable List<String> values)
Set the list of dependency attribute IDs to search for a value.

Parameters:
  `values` - the list of attribute IDs

### getNameIDFormatMap

@Unmodifiable @NotLive @Nonnull public Map<String,String> getNameIDFormatMap()
Get the map allowing to customize the NameID format URI on a per-attributeID basis.

Returns:
  the custom format map

### setNameIDFormatMap

public void setNameIDFormatMap(@Nullable Map<String,String> formatMap)
Set the map allowing to customize the NameID format URI on a per-attributeID basis.

Parameters:
  `formatMap` - the custom format map

### getDefaultNameIDFormat

@Nullable public String getDefaultNameIDFormat()
Get the default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.

Returns:
  the format URI

### setDefaultNameIDFormat

public void setDefaultNameIDFormat(@Nullable String uri)
Set the default format URI used to construct the NameID if a custom format for the attribute ID is not defined in `getNameIDFormatMap()`.

Parameters:
  `uri` - the format URI

### resolve

@Nullable public Subject resolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,List<IdPAttributeValue>> dependencyAttributes, @Nonnull AttributeAuthorityDescriptor roleDescriptor) throws ResolutionException
Resolve the `Subject` to use in query.

Specified by:
  `resolve` in interface `SubjectResolver`
Parameters:
  `resolutionContext` - the attribute resolution context in effect for the query
  `dependencyAttributes` - the dependency attributes in effect for the query
  `roleDescriptor` - the attribute authority role descriptor for the query
Returns:
  the subject, may be null
Throws:
  `ResolutionException` - if there is a fatal error during processing

### buildSubject

@Nonnull private Subject buildSubject(@Nonnull String value, @Nonnull String attributeID)
Build a Subject using the specified string as the NameID value.

Parameters:
  `value` - the string value
  `attributeID` - the attribute ID which contained the specified value
Returns:
  newly constructed Subject instance

### buildSubject

@Nullable private Subject buildSubject(@Nonnull NameID value)
Build a Subject using the specified NameID.

Parameters:
  `value` - the NameID value
Returns:
  newly constructed Subject instance, or null if there was a fatal error cloning the input NameID

### determinieNameIDFormat

@Nullable private String determinieNameIDFormat(@Nonnull String attributeID)
Determine the NamedID Format to use for the given dependency attribute ID.

Parameters:
  `attributeID` - the attribute ID to process
Returns:
  the NameID Format to use for attributes of the specified ID