Migrate decision node scripts to next-generation scripts
Different bindings are available to the decision node script depending on the scripting engine version; legacy or next-generation.
To migrate legacy scripts to next-generation scripts:
-
Complete the steps to migrate common bindings as described in Migrate to next-generation scripts.
-
Next, migrate the bindings specific to decision node scripts by referring to the information in the following table.
Binding Next-generation change New.
Use static method
goTo()
to set the script outcome.To send callbacks, instead of calling
Action.send()
, use the new callbacksBuilder functionality.New.
Instead of creating a
Callback
object and invokingAction.send()
, add callbacks using static methods on thecallbacksBuilder
object; for examplenameCallback
andpasswordCallback
. These callbacks are automatically sent when the script completes.Use the
getIdentity()
method on theidRepository
object to access attribute values.You must now explicitly call
store()
to persist changes to attribute values.New.
Generate JWT assertions in scripts.
New.
Validate JWT assertions in scripts.
The
sharedState
andtransientState
bindings are no longer supported.New.
Use this binding to access the
openidm
scripting functions supported in IDM.New.
Access the request cookies directly using this binding.
action
Use the action
binding to define the exit path from the node and set properties.
Learn more in Set script outcome and script attributes.
-
Legacy
-
Next-generation
var fr = JavaImporter(
org.forgerock.openam.auth.node.api.Action);
// Journey continues along the "false" path
action = fr.Action.goTo("false").build(); 1
// Journey continues along the "false" path
action.goTo("false"); 1
1 No need to import the Action
class to access the goTo
method.
Instead, call the goTo
method directly on the action
binding.
callbacksBuilder
Use the callbacksBuilder
object instead of importing Callback
classes.
Learn more in Use callbacks.
Legacy | Next-generation |
---|---|
|
|
1 Use the callbacksBuilder
object instead of importing Callback
classes.
2 No need to explicitly call send()
. The script sends every callback added to the callbacksBuilder
when it completes.
3 Use nodeState.putShared()
instead of sharedState.put()
and nodeState.putTransient()
instead of transientState.put()
.
4 No need to set the outcome, because action.goTo()
was invoked.
idRepository
Get an identity
from the idRepository
object to access attribute values.
Learn more in Access profile data.
Legacy | Next-generation |
---|---|
|
|
1 The idRepository
object is no longer used to get attribute values. Instead, use the getIdentity()
method of the new org.forgerock.openam.scripting.api.identity.ScriptIdentityRepository
interface to get the identity object.
2 Use the identity
object, instead of idRepository
, to get or set attribute values.
3 Adding or setting attributes on the identity
object does not persist data.
4 You must explicitly persist changes by calling the store
method.
For more information about the idRepository
binding, refer to Access profile data.
nodeState
Use the nodeState
binding to get and set the shared state of the journey.
Learn more in Access shared state data.
Legacy | Next-generation |
---|---|
|
|
1 Deprecated sharedState
and transientState
bindings are no longer available. Use nodeState.get()
instead. To store state values, use nodeState.putShared()
or nodeState.putTransient()
instead of sharedState.put()
and transientState.put()
.
2 No need to call methods such as asString()
or asMap()
.
3 New getObject()
method to retrieve a map with values stored across different states.
The map is immutable.
To get the UUID from |