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:

  1. In the Admin UI Select Configure > User Registration > Enable to enable user registration.

    This step creates a selfservice-registration.json file in your project's conf directory. There are a number of stages in that process by default, for example, the parameters stage:

    "stageConfigs" : [
        {
            "name" : "parameters",
            "parameterNames" : [
                "returnParams"
            ]
        },
    
    ...
    ]
  2. 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 the MathProblem stage directly after the parameters stage.

  3. 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 in selfservice-registration.json. For more information, see "All-In-One Registration".

  4. Save the changes to the selfservice-registration.json file.

    IDM reloads the configuration automatically—you do not need to restart the server.

  5. 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.

Read a different version of :