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
ResolverPlugins.-
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>TheResolverAttributeDefinitionDependencys this plug-in depends on.private Set<ResolverDataConnectorDependency>TheResolverDataConnectorDependencys this plug-in depends on.private final org.slf4j.LoggerClass logger.Strategy to get theProfileRequestContext.private booleanWhether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.private booleanWhether we add DisplayInformation to derived attributes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDisplayInformation(AttributeResolutionContext resolutionContext, IdPAttribute attribute) Deprecated, for removal: This API element is subject to removal in a future version.protected voidprotected voidprotected abstract ResolvedTypedoResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Perform the actual resolution.booleanGet 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 StringReturn a string which is to be prepended to all log messages.Gets the mechanism to find out theProfileRequestContext.inthashCode()booleanGet whether aResolutionExceptionthat occurred resolving attributes will be re-thrown.booleanDoes this plugin allow addition of Display Information?final ResolvedTyperesolve(AttributeResolutionContext resolutionContext) Performs the attribute resolution for this plugin.voidSets the predicate which defines whether this plugin is active for a given request.voidsetAttributeDependencies(Set<ResolverAttributeDefinitionDependency> dependencies) Sets the list of dependencies for this plugin.voidsetDataConnectorDependencies(Set<ResolverDataConnectorDependency> dependencies) Sets the list of dependencies for this plugin.voidSets the mechanism to find out theProfileRequestContext.voidsetPropagateResolutionExceptions(boolean propagate) Set whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.voidsetSuppressDisplayInformation(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 booleanstartTimer(AttributeResolutionContext resolutionContext) Conditionally start a timer at the beginning of the resolution process.private voidstopTimer(AttributeResolutionContext resolutionContext) Conditionally stop a timer at the end of the resolution process.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getIdMethods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface org.springframework.beans.factory.DisposableBean
destroyMethods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getIdMethods 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 anAttributeResolutionContextthat 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
TheResolverAttributeDefinitionDependencys this plug-in depends on. -
dataConnectorDependencies
TheResolverDataConnectorDependencys 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 aResolutionExceptionthat occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Specified by:
isPropagateResolutionExceptionsin interfaceResolverPlugin<ResolvedType>- Returns:
- true if
ResolutionExceptions are propagated, false if not
-
setPropagateResolutionExceptions
public void setPropagateResolutionExceptions(boolean propagate) Set whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Parameters:
propagate- true ifResolutionExceptions 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:
getActivationConditionin 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:
getAttributeDependenciesin 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:
getDataConnectorDependenciesin 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:
resolvein 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:
doDestroyin classAbstractInitializableComponent
-
doInitialize
- Overrides:
doInitializein 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.