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 classEvaluator bound to the Action semantic. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default language is Javascript.private final org.slf4j.LoggerClass logger.private final ScriptedAction.ActionScriptEvaluatorEvaluator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoExecute(ProfileRequestContext profileContext) protected voidReturn the custom (externally provided) object.static ScriptedActioninlineScript(String scriptSource) Factory to createScriptedActionfrom inline data.static ScriptedActioninlineScript(String engineName, String scriptSource) Factory to createScriptedActionfrom inline data.static ScriptedActionresourceScript(String engineName, Resource resource) Factory to createScriptedActionfrom aResource.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, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
doPreExecute, getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.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
-
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:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
inlineScript
@Nonnull public static ScriptedAction inlineScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException Factory to createScriptedActionfrom inline data.- Parameters:
scriptSource- the script, as a stringengineName- the language- Returns:
- the predicate
- Throws:
ScriptException- if the compile failsComponentInitializationException- if the scripting initialization fails
-
inlineScript
@Nonnull public static ScriptedAction inlineScript(@Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException Factory to createScriptedActionfrom inline data.- Parameters:
scriptSource- the script, as a string- Returns:
- the predicate
- Throws:
ScriptException- if the compile failsComponentInitializationException- if the scripting initialization fails
-