@ThreadSafe public class AttributeResolverImpl extends AbstractServiceableComponent<AttributeResolver> implements AttributeResolver, LegacyPrincipalDecoder
Resolver which in about summoning up bits of generic data from
the configuration (usually the metadata) in response to specific
Criterions. LegacyPrincipalDecoder in support of the deprecated
<PrincipalConnector>| Modifier and Type | Field and Description |
|---|---|
private Map<String,AttributeDefinition> |
attributeDefinitions
Attribute definitions defined for this resolver.
|
private Map<String,DataConnector> |
dataConnectors
Data connectors defined for this resolver.
|
private org.slf4j.Logger |
log
Class logger.
|
private String |
logPrefix
cache for the log prefix - to save multiple recalculations.
|
private LegacyPrincipalDecoder |
principalConnector
The Principal mapper.
|
private Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> |
profileContextStrategy
Strategy to get the
ProfileRequestContext. |
| Constructor and Description |
|---|
AttributeResolverImpl()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
canonicalize(SubjectCanonicalizationContext context) |
protected void |
checkPlugInDependencies(String circularCheckPluginId,
ResolverPlugin<?> plugin,
Set<String> checkedPlugins)
Checks to ensure that there are no circular dependencies or dependencies on non-existent plugins.
|
protected void |
doInitialize() |
protected void |
finalizeResolvedAttributes(AttributeResolutionContext resolutionContext)
Finalizes the set of resolved attributes and places them in the
AttributeResolutionContext. |
Map<String,AttributeDefinition> |
getAttributeDefinitions()
Gets the collection of attribute definitions for this resolver.
|
AttributeResolver |
getComponent() |
Map<String,DataConnector> |
getDataConnectors()
Gets the unmodifiable collection of data connectors for this resolver.
|
protected Collection<String> |
getToBeResolvedAttributeIds(AttributeResolutionContext resolutionContext)
Gets the list of attributes, identified by IDs, that should be resolved.
|
boolean |
hasValidConnectors() |
protected void |
resolveAttributeDefinition(String attributeId,
AttributeResolutionContext resolutionContext)
Resolve the
AttributeDefinition which has the specified ID. |
void |
resolveAttributes(AttributeResolutionContext resolutionContext)
Resolves the attribute for the given request.
|
protected void |
resolveDataConnector(String connectorId,
AttributeResolutionContext resolutionContext)
Resolve the
DataConnector which has the specified ID. |
protected void |
resolveDependencies(ResolverPlugin<?> plugin,
AttributeResolutionContext resolutionContext)
Resolves all the dependencies for a given plugin.
|
void |
setAttributeDefinitions(Collection<AttributeDefinition> definitions)
Sets the attribute definitions for this resolver.
|
void |
setDataConnectors(Collection<DataConnector> connectors)
Sets the data connectors for this resolver.
|
void |
setId(String resolverId) |
void |
setPrincipalDecoder(LegacyPrincipalDecoder principalResolver)
Set the Decoder.
|
void |
setProfileContextLookupStrategy(Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> strategy)
Set the mechanism to obtain the
ProfileRequestContext. |
private boolean |
startTimer(AttributeResolutionContext resolutionContext)
Conditionally start a timer at the beginning of the resolution process.
|
private void |
stopTimer(AttributeResolutionContext resolutionContext)
Conditionally stop a timer at the end of the resolution process.
|
doDestroy, getApplicationContext, pinComponent, setApplicationContext, unloadComponent, unpinComponentgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetId@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private Map<String,AttributeDefinition> attributeDefinitions
@NonnullAfterInit private Map<String,DataConnector> dataConnectors
@NonnullAfterInit private String logPrefix
@Nullable private LegacyPrincipalDecoder principalConnector
@Nonnull private Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> profileContextStrategy
ProfileRequestContext.public void setId(@Nonnull@NotEmpty String resolverId)
setId in class AbstractIdentifiedInitializableComponentpublic void setAttributeDefinitions(@Nullable@NullableElements Collection<AttributeDefinition> definitions)
definitions - attribute definitions loaded in to this resolver@Nonnull @NonnullElements @Unmodifiable public Map<String,AttributeDefinition> getAttributeDefinitions()
getAttributeDefinitions in interface AttributeResolverpublic void setDataConnectors(@Nullable@NullableElements Collection<DataConnector> connectors)
connectors - data connectors loaded in to this resolver@Nonnull @NonnullElements @Unmodifiable public Map<String,DataConnector> getDataConnectors()
getDataConnectors in interface AttributeResolverpublic void setPrincipalDecoder(@Nullable LegacyPrincipalDecoder principalResolver)
principalResolver - code to resolve the principalpublic void setProfileContextLookupStrategy(@Nonnull Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> strategy)
ProfileRequestContext.strategy - lookup strategypublic void resolveAttributes(@Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException
AttributeResolutionContext.getRequestedIdPAttributeNames(), the resolver will not fail
if they can not be resolved. This information serves only as a hint to the resolver to, potentially, optimize the
resolution of attributes.resolveAttributes in interface AttributeResolverresolutionContext - the attribute resolution context that identifies the request subject and accumulates the
resolved attributesResolutionException - thrown if there is a problem resolving the attributes for the subject@Nonnull @NonnullElements protected Collection<String> getToBeResolvedAttributeIds(@Nonnull AttributeResolutionContext resolutionContext)
AttributeResolutionContext.getRequestedIdPAttributeNames() is not empty then those attributes are the
ones to be resolved, otherwise all registered attribute definitions are to be resolved.resolutionContext - current resolution contextprotected void resolveAttributeDefinition(@Nonnull String attributeId, @Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException
AttributeDefinition which has the specified ID.
The results of the resolution are stored in the given AttributeResolutionContext.attributeId - id of the attribute definition to resolveresolutionContext - resolution context that we are working inResolutionException - if unable to resolve the requested attribute definitionprotected void resolveDataConnector(@Nonnull String connectorId, @Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException
DataConnector which has the specified ID.
The results of the resolution are stored in the given AttributeResolutionContext.connectorId - id of the data connector to resolveresolutionContext - resolution context that we are working inResolutionException - if unable to resolve the requested connectorprotected void resolveDependencies(@Nonnull ResolverPlugin<?> plugin, @Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException
plugin - plugin whose dependencies should be resolvedresolutionContext - current resolution contextResolutionException - thrown if there is a problem resolving a dependencyprotected void finalizeResolvedAttributes(@Nonnull AttributeResolutionContext resolutionContext)
AttributeResolutionContext. The result of
each AttributeDefinition resolution is inspected. If the result is not null, a dependency-only attribute,
or an attribute that contains no values then it becomes part of the final set of resolved attributes.
Values are also de-duplicated here, so that all the intermediate operations maintain the coherency of multi-valued result sets produced by data connectors.
resolutionContext - current resolution contextprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractServiceableComponent<AttributeResolver>ComponentInitializationExceptionprotected void checkPlugInDependencies(String circularCheckPluginId, ResolverPlugin<?> plugin, Set<String> checkedPlugins) throws ComponentInitializationException
circularCheckPluginId - the ID of the plugin currently being checked for circular dependenciesplugin - current plugin, in the dependency tree of the plugin being checked, that we're currently looking atcheckedPlugins - IDs of plugins that have already been checked and known to be goodComponentInitializationException - thrown if there is a dependency loop@Nonnull public AttributeResolver getComponent()
getComponent in interface ServiceableComponent<AttributeResolver>getComponent in class AbstractServiceableComponent<AttributeResolver>@Nullable public String canonicalize(@Nonnull SubjectCanonicalizationContext context) throws ResolutionException
canonicalize in interface LegacyPrincipalDecoderResolutionExceptionpublic boolean hasValidConnectors()
hasValidConnectors in interface LegacyPrincipalDecoderprivate boolean startTimer(@Nonnull AttributeResolutionContext resolutionContext)
resolutionContext - attribute resolution contextstopTimer(AttributeResolutionContext) method needs to be calledprivate void stopTimer(@Nonnull AttributeResolutionContext resolutionContext)
resolutionContext - attribute resolution contextCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.