Class AbstractResolverPlugin<ResolvedType>
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<ResolvedType>
- Type Parameters:
ResolvedType
- object type this plug-in resolves to
- All Implemented Interfaces:
ResolverPlugin<ResolvedType>
,Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,UnmodifiableComponent
,DisposableBean
- Direct Known Subclasses:
AbstractAttributeDefinition
,AbstractDataConnector
@ThreadSafe
public abstract class AbstractResolverPlugin<ResolvedType>
extends AbstractIdentifiableInitializableComponent
implements ResolverPlugin<ResolvedType>, DisposableBean
Base class for all
ResolverPlugin
s.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Predicate<ProfileRequestContext>
Criterion that must be met for this plugin to be active for the given request.private Set<ResolverAttributeDefinitionDependency>
TheResolverAttributeDefinitionDependency
s this plug-in depends on.private Set<ResolverDataConnectorDependency>
TheResolverDataConnectorDependency
s this plug-in depends on.private final org.slf4j.Logger
Class logger.Strategy to get theProfileRequestContext
.private boolean
Whether anAttributeResolutionContext
that occurred resolving attributes will be re-thrown.private boolean
Whether we add DisplayInformation to derived attributes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDisplayInformation
(AttributeResolutionContext resolutionContext, IdPAttribute attribute) Deprecated, for removal: This API element is subject to removal in a future version.protected void
protected void
protected abstract ResolvedType
doResolve
(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Perform the actual resolution.boolean
Get the predicate which defines whether this plugin is active for a given request.Gets the unmodifiable list of attributeDependencies for this plugin.Gets the unmodifiable list of dependencies for this plugin.protected abstract String
Return a string which is to be prepended to all log messages.Gets the mechanism to find out theProfileRequestContext
.int
hashCode()
boolean
Get whether aResolutionException
that occurred resolving attributes will be re-thrown.boolean
Does this plugin allow addition of Display Information?final ResolvedType
resolve
(AttributeResolutionContext resolutionContext) Performs the attribute resolution for this plugin.void
Sets the predicate which defines whether this plugin is active for a given request.void
setAttributeDependencies
(Set<ResolverAttributeDefinitionDependency> dependencies) Sets the list of dependencies for this plugin.void
setDataConnectorDependencies
(Set<ResolverDataConnectorDependency> dependencies) Sets the list of dependencies for this plugin.void
Sets the mechanism to find out theProfileRequestContext
.void
setPropagateResolutionExceptions
(boolean propagate) Set whether anAttributeResolutionContext
that occurred resolving attributes will be re-thrown.void
setSuppressDisplayInformation
(boolean what) Deprecated, for removal: This API element is subject to removal in a future version.Display Information should be consulted at point of useprivate 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.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
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.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
propagateResolutionExceptions
private boolean propagateResolutionExceptionsWhether anAttributeResolutionContext
that occurred resolving attributes will be re-thrown. -
suppressDisplayInformation
private boolean suppressDisplayInformationWhether we add DisplayInformation to derived attributes. -
profileContextStrategy
Strategy to get theProfileRequestContext
. -
activationCondition
Criterion that must be met for this plugin to be active for the given request. -
attributeDependencies
TheResolverAttributeDefinitionDependency
s this plug-in depends on. -
dataConnectorDependencies
TheResolverDataConnectorDependency
s this plug-in depends on.
-
-
Constructor Details
-
AbstractResolverPlugin
public AbstractResolverPlugin()Constructor.
-
-
Method Details
-
isSuppressDisplayInformation
public boolean isSuppressDisplayInformation()Does this plugin allow addition of Display Information?- Returns:
- whether we are suppressing
-
setSuppressDisplayInformation
Deprecated, for removal: This API element is subject to removal in a future version.Display Information should be consulted at point of useSet whether we suppress addition of Display Information.- Parameters:
what
- true if we suppress the addition.
-
isPropagateResolutionExceptions
public boolean isPropagateResolutionExceptions()Get whether aResolutionException
that occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Specified by:
isPropagateResolutionExceptions
in interfaceResolverPlugin<ResolvedType>
- Returns:
- true if
ResolutionException
s are propagated, false if not
-
setPropagateResolutionExceptions
public void setPropagateResolutionExceptions(boolean propagate) Set whether anAttributeResolutionContext
that occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Parameters:
propagate
- true ifResolutionException
s are propagated, false if not
-
getProfileContextStrategy
Gets the mechanism to find out theProfileRequestContext
.- Returns:
- the mechanism
-
setProfileContextStrategy
public void setProfileContextStrategy(Function<AttributeResolutionContext, ProfileRequestContext> strategy) Sets the mechanism to find out theProfileRequestContext
.- Parameters:
strategy
- the mechanism
-
getActivationCondition
Get the predicate which defines whether this plugin is active for a given request.- Specified by:
getActivationCondition
in interfaceResolverPlugin<ResolvedType>
- Returns:
- the predicate.
-
setActivationCondition
Sets the predicate which defines whether this plugin is active for a given request.- Parameters:
pred
- what to set
-
getAttributeDependencies
@NonnullAfterInit @NonnullElements @Unmodifiable public Set<ResolverAttributeDefinitionDependency> getAttributeDependencies()Gets the unmodifiable list of attributeDependencies for this plugin.- Specified by:
getAttributeDependencies
in interfaceResolverPlugin<ResolvedType>
- Returns:
- unmodifiable list of dependencies for this plugin, never null
-
getDataConnectorDependencies
@NonnullAfterInit @NonnullElements @Unmodifiable public Set<ResolverDataConnectorDependency> getDataConnectorDependencies()Gets the unmodifiable list of dependencies for this plugin.- Specified by:
getDataConnectorDependencies
in interfaceResolverPlugin<ResolvedType>
- Returns:
- unmodifiable list of dependencies for this plugin, never null
-
setAttributeDependencies
public void setAttributeDependencies(@Nonnull @NonnullElements Set<ResolverAttributeDefinitionDependency> dependencies) Sets the list of dependencies for this plugin.- Parameters:
dependencies
- unmodifiable list of dependencies for this plugin
-
setDataConnectorDependencies
public void setDataConnectorDependencies(@Nonnull @NonnullElements Set<ResolverDataConnectorDependency> dependencies) Sets the list of dependencies for this plugin.- Parameters:
dependencies
- unmodifiable list of dependencies for this plugin
-
resolve
@Nullable public final ResolvedType resolve(@Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException Performs the attribute resolution for this plugin.This method first checks to see if this plugin has been initialized and has not be destroyed. Then it checks if the plugins activation criterion has been met. Finally it delegates to
doResolve(AttributeResolutionContext, AttributeResolverWorkContext)
. If an exception is thrown andisPropagateResolutionExceptions()
is false the exception is logged but not re-thrown, otherwise it is re-thrown.- Specified by:
resolve
in interfaceResolverPlugin<ResolvedType>
- Parameters:
resolutionContext
- current attribute resolution context- Returns:
- the attributes made available by the resolution, or null if no attributes were resolved
- Throws:
ResolutionException
- thrown if there was a problem resolving the attributes
-
addDisplayInformation
@Deprecated(since="4.2", forRemoval=true) public void addDisplayInformation(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull IdPAttribute attribute) Deprecated, for removal: This API element is subject to removal in a future version.These values should be calculated at point of use Controllable via theisSuppressDisplayInformation()
method.Look at the resolution context for an attribute registry and use it to garnish the attribute.- Parameters:
resolutionContext
- where to get the registry fromattribute
- what to garnish
-
doDestroy
protected void doDestroy()- Overrides:
doDestroy
in classAbstractInitializableComponent
-
doInitialize
- Overrides:
doInitialize
in classAbstractIdentifiedInitializableComponent
- Throws:
ComponentInitializationException
-
hashCode
public int hashCode() -
equals
-
doResolve
@Nullable protected abstract ResolvedType doResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException Perform the actual resolution. The resolved attribute(s) should not be recorded in the work context.- Parameters:
resolutionContext
- current resolution contextworkContext
- child context where intermediate results are tracked- Returns:
- the resolved attributes or null if no attributes were resolved
- Throws:
ResolutionException
- thrown if there is a problem resolving the attributes- See Also:
-
startTimer
Conditionally start a timer at the beginning of the resolution process.- Parameters:
resolutionContext
- attribute resolution context- Returns:
- true iff the
stopTimer(AttributeResolutionContext)
method needs to be called
-
stopTimer
Conditionally stop a timer at the end of the resolution process.- Parameters:
resolutionContext
- attribute resolution context
-
getLogPrefix
Return a string which is to be prepended to all log messages.- Returns:
- a log prefix
-
isSuppressDisplayInformation()
method.