7.6. Login with Hard Coded Credentials

Now that OpenIG can proxy all traffic to and from the application, the next step is to configure OpenIG to intercept the login page, and POST the login form to the Portal.

$ cp $HOME/forgerock-sample-configs/WordPressLogin.json
 $HOME/.ForgeRock/OpenIG/config.json
$ jetty.sh restart

As you changed the OpenIG configuration file, you must restart the OpenIG container. After restarting you should be able to go to http://demo.forgerock.com:8080/wordpress, click on the login link, and be logged in as the user george without entering your credentials. OpenIG has intercepted the request for the login page, created the login form, and POSTed the request to the Portal.

To see what is happening behind the scenes, take a look at $HOME/.ForgeRock/OpenIG/config.json. This time you notice the HandlerServlet is calling the DispatchHandler. The DispatchHandler has a condition which checks for the presence of wp-login.php (the login page) in the URI path. If the condition is false (no login page), the ClientHandler is called sending the request on to the Portal. If the condition is true, OpenIG has found the login page, and calls the LoginChain for further processing. The LoginChain calls its filter, the LoginRequestFilter, which creates the login form, and then calls the ClientHandler to send the form to the Portal. If you look at the LoginRequestFilter, you notice it defines the method, URI, and form parameters for the request which is sent by the ClientHandler. In the form parameters you see the hard coded credentials, which are used to log you in as the user george.