@ThreadSafe public class ScriptedAttributeDefinition extends AbstractAttributeDefinition
AttributeDefinition that executes a script in order to populate the
values of the generated attribute.
The evaluated script has access to the following information:
IdPAttribute.context and whose value is the current
AttributeResolutionContextIdPAttribute and its value is the List of IdPAttributeValue
for the attribute.
The evaluated script should populate the values of the newly constructed IdPAttribute mentioned above. No
other information from the script will be taken in to account.
| Modifier and Type | Field and Description |
|---|---|
private Object |
customObject
The custom object we inject into all scripts.
|
private org.slf4j.Logger |
log
Class logger.
|
private Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> |
prcLookupStrategy
Strategy used to locate the
ProfileRequestContext to use. |
private Function<org.opensaml.profile.context.ProfileRequestContext,SubjectContext> |
scLookupStrategy
Strategy used to locate the
SubjectContext to use. |
private EvaluableScript |
script
Script to be evaluated.
|
| Constructor and Description |
|---|
ScriptedAttributeDefinition()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected IdPAttribute |
doAttributeDefinitionResolve(AttributeResolutionContext resolutionContext,
AttributeResolverWorkContext workContext) |
protected void |
doInitialize() |
Object |
getCustomObject()
Return the custom (externally provided) object.
|
EvaluableScript |
getScript()
Gets the script to be evaluated.
|
private ScriptContext |
getScriptContext(AttributeResolutionContext resolutionContext,
AttributeResolverWorkContext workContext)
Constructs the
ScriptContext used when evaluating the script. |
void |
setCustomObject(Object object)
Set the custom (externally provided) object.
|
void |
setProfileRequestContextLookupStrategy(Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> strategy)
Set the strategy used to locate the
ProfileRequestContext associated with a given
AttributeResolutionContext. |
void |
setScript(EvaluableScript definitionScript)
Sets the script to be evaluated.
|
void |
setSubjectContextLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,SubjectContext> strategy)
Set the strategy used to locate the
SubjectContext associated with a given
AttributeResolutionContext. |
doResolve, getAttributeEncoders, getDisplayDescriptions, getDisplayNames, getLogPrefix, getSourceAttributeId, isDependencyOnly, setAttributeEncoders, setDependencyOnly, setDisplayDescriptions, setDisplayNames, setSourceAttributeIddoDestroy, equals, getActivationCondition, getDependencies, getProfileContextStrategy, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setDependencies, setProfileContextStrategy, setPropagateResolutionExceptionssetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetActivationCondition, getDependencies, isPropagateResolutionExceptions, resolveinitialize, isInitializeddestroy, isDestroyedgetId@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private EvaluableScript script
@Nonnull private Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> prcLookupStrategy
ProfileRequestContext to use.@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,SubjectContext> scLookupStrategy
SubjectContext to use.@Nullable public Object getCustomObject()
@Nullable public void setCustomObject(Object object)
object - the custom object@NonnullAfterInit public EvaluableScript getScript()
public void setScript(@Nonnull EvaluableScript definitionScript)
definitionScript - the script to be evaluatedpublic void setProfileRequestContextLookupStrategy(@Nonnull Function<AttributeResolutionContext,org.opensaml.profile.context.ProfileRequestContext> strategy)
ProfileRequestContext associated with a given
AttributeResolutionContext.strategy - strategy used to locate the ProfileRequestContext associated with a given
AttributeResolutionContextpublic void setSubjectContextLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,SubjectContext> strategy)
SubjectContext associated with a given
AttributeResolutionContext.strategy - strategy used to locate the SubjectContext associated with a given
AttributeResolutionContextprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractAttributeDefinitionComponentInitializationException@Nullable protected IdPAttribute doAttributeDefinitionResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
doAttributeDefinitionResolve in class AbstractAttributeDefinitionResolutionException@Nonnull private ScriptContext getScriptContext(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
ScriptContext used when evaluating the script.resolutionContext - current resolution contextworkContext - current work contextResolutionException - thrown if dependent data connectors or attribute definitions can not be resolvedCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.