Identity Gateway 2023.11

Use the sample application

ForgeRock provides a mockup web application for testing IG configurations. The sample application is used in the examples in this guide and the Gateway guide.

Prepare the network

Configure the network to include hosts for IG, AM, and the sample application. For more information about host files, refer to the Wikipedia entry, Hosts (file).

  1. Add the following entry to your host file:

    • Linux

    • Windows

    /etc/hosts
    %SystemRoot%\system32\drivers\etc\hosts
    127.0.0.1  localhost ig.example.com app.example.com am.example.com

Download the sample application

  1. Download IG-sample-application-2023.11.0.jar, from the ForgeRock BackStage download site.

Start the sample application

  1. Start the sample application:

    $ java -jar IG-sample-application-2023.11.0.jar
    
    [...] [INFO   ] All 8 verticles started on ports : [8081, 8444]
    [...] [INFO   ] Using session timeout of: 60s
    [...] [INFO   ] Using AM base for OpenID Discovery URL: http://am.example.com:8088/openam/oauth2
    [...] [INFO   ] Press Ctrl+C to stop the server.

    By default this server listens for HTTP on port 8081, and for HTTPS on port 8444. If one or both of those ports are not free, specify other ports:

    $ java -jar IG-sample-application-2023.11.0.jar 8888 8889
  2. Check that the sample application is running in one of the following ways:

    1. Go to http://localhost:8081/home to access the home page of the sample application. Information about the browser request is displayed.

    2. Go to http://localhost:8081/login to access the login page of the sample application, and then log in with username demo and password Ch4ng31t. The username and some information about the browser request is displayed.

Stop the sample application

  1. In the terminal where the sample application is running, select CTRL+C to stop the app.

Serve static resources

When the sample application is used with IG in examples, it must serve static resources, such as the .css. Similarly, browser requests often serve resources that don’t need protection, such as icons and .gif files.

Add the following route to IG to serve the sample application .css and other static resources:

  • Linux

  • Windows

$HOME/.openig/config/routes/00-static-resources.json
%appdata%\OpenIG\config\routes\00-static-resources.json
{
  "name" : "00-static-resources",
  "baseURI" : "http://app.example.com:8081",
  "condition": "${find(request.uri.path,'^/css') or matchesWithRegex(request.uri.path, '^/.*\\\\.ico$') or matchesWithRegex(request.uri.path, '^/.*\\\\.gif$')}",
  "handler": "ReverseProxyHandler"
}

Configuration options

To view the command-line options for the sample application, start it with the -h option:

$ java -jar IG-sample-application-2023.11.0.jar -h

Usage: <main class> [options]
Options:
--http
The HTTP port number.
Default: 8081
--https
The HTTPS port number.
Default: 8444
--session
The session timeout in seconds.
Default: 60
--am-discovery-url
The AM URL base for OpenID Provider Configuration.
Default: http://am.example.com:8088/openam/oauth2
-h, --help
Default: false
Copyright © 2010-2024 ForgeRock, all rights reserved.