Sample Stage

ForgeRock provides a sample custom stage project with the minimum classes and project file required for any self-service stage. The sample project has a dependency on the forgerock-selfservice-core artifact. Engage ForgeRock support for access to the required repositories.

The sample project implements a stage named MathProblem, which generates a simple math problem that must be completed in order to progress to the next stage.

The project includes the following files, required for any custom self-service stage:

A Maven project file (pom.xml)

Pay particular attention to the maven-bundle-plugin in this file:

<plugins>
    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Fragment-Host>org.forgerock.openidm.selfservice</Fragment-Host>
            </instructions>
        </configuration>
    </plugin>
</plugins> 

This plugin indicates that Apache Felix should attach the custom stage artifact to IDM’s self-service bundle.

A configuration class

(src/main/java/org/forgerock/selfservice/custom/MathProblemStageConfig.java)

The configuration class reads configuration data from a corresponding configuration (JSON) file. The class represents each configuration item for the stage as properties of the class.

An implementation class

(src/main/java/org/forgerock/selfservice/custom/MathProblemStage.java)

The implementation class is the main orchestration class for the stage.

Build the Sample Stage

To build the sample stage, you must have Apache Maven installed.

  1. Clone the ForgeRock Selfservice Custom Stage repository.

  2. Change to the root directory of the project you cloned:

    cd /path/to/forgerock-selfservice-custom-stage
  3. This version of IDM works with version 26.1.x of ForgeRock Commons. Locate the latest version 26.1.x tag:

    1. List the latest tags for this version:

      git tag --list | grep 26.1
      26.1.0-20210407090058-81dd8fe
      ...
      26.1.0-latest
    2. Check out the latest version:

      git checkout -b test tags/26.1.0-latest
      Switched to a new branch 'test'
  4. Build the sample stage:

    mvn clean install

    This build process creates the forgerock-selfservice-custom-stage/self-service/forgerock-selfservice -custom-stage/target/forgerock-selfservice-custom-stage-version.jar file.

  5. Copy the compiled stage to the openidm/bundle directory:

    cp target/forgerock-selfservice-custom-stage-version.jar /path/to/openidm/bundle/
  6. Restart IDM.

Read a different version of :