Testing the Custom Stage
Stages are implemented as part of a self-service process. For more information, see "The Self-Service Process Flow". To test your custom stage, you need to add it to a self-service process. You can create a new process, or use one of the default processes available through the Admin UI.
In this example, we add the custom stage to the User Registration process and test it as part of self-registration, as follows:
In the Admin UI Select Configure > User Registration > Enable to enable user registration.
This step creates a
selfservice-registration.json
file in your project'sconf
directory. There are a number of stages in that process by default, for example, theparameters
stage:"stageConfigs" : [ { "name" : "parameters", "parameterNames" : [ "returnParams" ] }, ... ]
Add your custom stage to the process by creating a configuration item in the
stageConfigs
array:"stageConfigs" : [ { "name" : "parameters", "parameterNames" : [ "returnParams" ] }, { "class" : "org.forgerock.selfservice.custom.MathProblemStageConfig", "leftValue" : 12, "rightValue" : 4 }, ... ]
Note that self-service stages can generally not be configured in random order. For example, some stages require input from the process
state
that has been populated by a preceding stage. For the purposes of this example, add theMathProblem
stage directly after theparameters
stage.Disable all-in-one registration.
By default, the registration phase has all-in-one registration enabled. All-in-one registration covers a number of registration stages. For the purposes of testing the custom stage, disable all-in-one registration by setting
"allInOneRegistration" : false
inselfservice-registration.json
. For more information, see "All-In-One Registration".Save the changes to the
selfservice-registration.json
file.IDM reloads the configuration automatically—you do not need to restart the server.
Log in to the End User UI (at
https://localhost:8443/
by default) and select Register.The first stage to be displayed should be the Math Problem you configured previously.