Package net.shibboleth.idp.profile
Class ScriptedAction
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.profile.action.AbstractConditionalProfileAction
-
- net.shibboleth.idp.profile.AbstractProfileAction
-
- net.shibboleth.idp.profile.ScriptedAction
-
- All Implemented Interfaces:
net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.InitializableComponent,org.opensaml.profile.action.ProfileAction,Aware,MessageSource,MessageSourceAware,Action
public class ScriptedAction extends AbstractProfileAction
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 Classes Modifier and Type Class Description private classScriptedAction.ActionScriptEvaluatorEvaluator bound to the Action semantic.
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ENGINEThe default language is Javascript.private org.slf4j.LoggerlogClass logger.private ScriptedAction.ActionScriptEvaluatorscriptEvaluatorEvaluator.
-
Constructor Summary
Constructors Constructor Description ScriptedAction(net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript)Constructor.ScriptedAction(net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript, String extraInfo)Deprecated....
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoExecute(org.opensaml.profile.context.ProfileRequestContext profileContext)protected voiddoInitialize()ObjectgetCustomObject()Return the custom (externally provided) object.(package private) static ScriptedActioninlineScript(String scriptSource)Factory to createScriptedActionfrom inline data.(package private) static ScriptedActioninlineScript(String engineName, String scriptSource)Factory to createScriptedActionfrom inline data.(package private) static ScriptedActionresourceScript(String engineName, Resource resource)Factory to createScriptedActionfrom aResource.(package private) static ScriptedActionresourceScript(Resource resource)Factory to createScriptedActionfrom aResource.voidsetCustomObject(Object object)Set the custom (externally provided) object.voidsetHideExceptions(boolean flag)Set whether to hide exceptions in script execution (default is false).-
Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getMessage, getMessage, getMessage, 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, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
DEFAULT_ENGINE
@Nonnull @NotEmpty public static final String DEFAULT_ENGINE
The default language is Javascript.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
scriptEvaluator
@Nonnull private final ScriptedAction.ActionScriptEvaluator scriptEvaluator
Evaluator.
-
-
Constructor Detail
-
ScriptedAction
@Deprecated public ScriptedAction(@Nonnull net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript, @Nullable String extraInfo)
Deprecated....Constructor.- Parameters:
theScript- the script we will evaluateextraInfo- debugging information
-
ScriptedAction
public ScriptedAction(@Nonnull net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript)Constructor.- Parameters:
theScript- the script we will evaluate
-
-
Method Detail
-
getCustomObject
@Nullable public Object getCustomObject()
Return the custom (externally provided) object.- Returns:
- the custom object
-
setCustomObject
@Nullable public void setCustomObject(@Nullable Object object)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
protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.utilities.java.support.component.AbstractInitializableComponent- Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException
-
doExecute
public void doExecute(@Nullable org.opensaml.profile.context.ProfileRequestContext profileContext)- Overrides:
doExecutein classorg.opensaml.profile.action.AbstractProfileAction
-
resourceScript
static ScriptedAction resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException
Factory to createScriptedActionfrom 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 createScriptedActionfrom 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 createScriptedActionfrom inline data.- Parameters:
scriptSource- the script, as a stringengineName- the language- Returns:
- the predicate
- Throws:
ScriptException- if the compile fails
-
inlineScript
static ScriptedAction inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException
Factory to createScriptedActionfrom inline data.- Parameters:
scriptSource- the script, as a string- Returns:
- the predicate
- Throws:
ScriptException- if the compile fails
-
-