Package net.shibboleth.idp.profile
Class ScriptedAction
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
,Aware
,MessageSource
,MessageSourceAware
,Action
An action which calls out to a supplied script.
The return value must be an event ID to signal. As this is a generic wrapper, the action may return any event depending on the context of the activity, and may manipulate the profile context tree as required.
- Event:
EventIds.INVALID_PROFILE_CTX
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Evaluator bound to the Action semantic. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default language is Javascript.private final org.slf4j.Logger
Class logger.private final ScriptedAction.ActionScriptEvaluator
Evaluator. -
Constructor Summary
ConstructorsConstructorDescriptionScriptedAction
(EvaluableScript theScript) Constructor.ScriptedAction
(EvaluableScript theScript, String extraInfo) Deprecated.... -
Method Summary
Modifier and TypeMethodDescriptionvoid
doExecute
(ProfileRequestContext profileContext) protected void
Return the custom (externally provided) object.(package private) static ScriptedAction
inlineScript
(String scriptSource) Factory to createScriptedAction
from inline data.(package private) static ScriptedAction
inlineScript
(String engineName, String scriptSource) Factory to createScriptedAction
from inline data.(package private) static ScriptedAction
resourceScript
(String engineName, Resource resource) Factory to createScriptedAction
from aResource
.(package private) static ScriptedAction
resourceScript
(Resource resource) Factory to createScriptedAction
from aResource
.void
setCustomObject
(Object object) Set the custom (externally provided) object.void
setHideExceptions
(boolean flag) Set whether to hide exceptions in script execution (default is false).Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy
Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
doPreExecute, getActivationCondition, setActivationCondition
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplier
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
DEFAULT_ENGINE
The default language is Javascript.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
scriptEvaluator
Evaluator.
-
-
Constructor Details
-
ScriptedAction
Deprecated....Constructor.- Parameters:
theScript
- the script we will evaluateextraInfo
- debugging information
-
ScriptedAction
Constructor.- Parameters:
theScript
- the script we will evaluate
-
-
Method Details
-
getCustomObject
Return the custom (externally provided) object.- Returns:
- the custom object
-
setCustomObject
Set the custom (externally provided) object.- Parameters:
object
- the custom object
-
setHideExceptions
public void setHideExceptions(boolean flag) Set whether to hide exceptions in script execution (default is false).- Parameters:
flag
- flag to set- Since:
- 3.4.0
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
doExecute
- Overrides:
doExecute
in classAbstractProfileAction
-
resourceScript
static ScriptedAction resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException Factory to createScriptedAction
from aResource
.- Parameters:
resource
- the resource to look atengineName
- the language- Returns:
- the predicate
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceScript
static ScriptedAction resourceScript(@Nonnull Resource resource) throws ScriptException, IOException Factory to createScriptedAction
from aResource
.- Parameters:
resource
- the resource to look at- Returns:
- the predicate
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
inlineScript
static ScriptedAction inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedAction
from inline data.- Parameters:
scriptSource
- the script, as a stringengineName
- the language- Returns:
- the predicate
- Throws:
ScriptException
- if the compile fails
-
inlineScript
Factory to createScriptedAction
from inline data.- Parameters:
scriptSource
- the script, as a string- Returns:
- the predicate
- Throws:
ScriptException
- if the compile fails
-