Handle multiple visits to the same node
An authentication flow can return to a decision node in the following ways:
-
Route the failure outcome through a Retry Limit Decision node.
This node can limit how many times a user can enter incorrect authentication details when the user is directed to an earlier node in the tree to re-enter their information. For example, to an earlier Username Collector node.
-
Re-route directly to the current processing node.
To achieve this, use the
Action.send()
method rather thanAction.goTo()
. TheAction.goTo
method passes control to the next node in the tree. TheAction.send()
method takes a list of callbacks that you can construct in the current node. The return value is anActionBuilder
that can be used to create anAction
as follows:ActionBuilder action = Action.send(ImmutableList.of(new ChoiceCallback(), new ConfirmationCallback()));
A typical example of returning to the same node is a password change screen where the user must enter their current password, new password, and new password confirmation. The node that processes these callbacks needs to remain on the screen and display an error message if any of the data entered by the user is incorrect. For example, if the new password and password confirmation don’t match.
When a ConfirmationCallback
is invoked on a screen that was produced by Action.send()
,
it always routes back to the node that created it.
After the details are valid, return an Action
created using Action.goTo()
and tree processing can continue as
normal.