Client Script Auth Tree Node

A simple authentication node for ForgeRock's Identity Platform 5.5 and above. This node executes a client-side browser Javascript, returning any configured results to a shared state object.

Project Readme

Client Script Authentication Node

A simple authentication node for ForgeRock's [Identity Platform][forgerock_platform] 5.5 and above. This node executes a client-side browser Javascript, returning any configured results to a shared state object.


Copy the .jar file from the ../target directory into the ../web-container/webapps/openam/WEB-INF/lib directory where AM is deployed. Restart the web container to pick up the new node. The node will then appear in the authentication trees components palette.


Ensure that a valid client-side authentication script is defined (see below for example), then add this node to an authentication tree. In the node configuration select the client-side script, and specify the name of the shared state object to store any results output from the script.

To Build

The code in this repository has binary dependencies that live in the ForgeRock maven repository. Maven can be configured to authenticate to this repository by following the following ForgeRock Knowledge Base Article.

Edit the necessary as appropriate. To rebuild, run "mvn clean install" in the directory containing the pom.xml


Client Script Configuration


Example client script which gathers the browser geolocation and returns it as a JSON object:

collectGeolocationInfo = function (callback) {
  var geolocationInfo = {},
  successCallback = function(position) {
      geolocationInfo.longitude = position.coords.longitude;
      geolocationInfo.latitude = position.coords.latitude;
  errorCallback = function(error) {
      console.warn("Cannot collect geolocation information. " + error.code + ": " + error.message);
  if (navigator && navigator.geolocation) {
      // NB: If user chooses 'Not now' on Firefox neither callback gets called
      navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
  } else {
      console.warn("Cannot collect geolocation information. navigator.geolocation is not defined.");

autoSubmitDelay = 30000;
collectGeolocationInfo(function(geolocationInfo) {
    output.value = JSON.stringify(geolocationInfo);


The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. ForgeRock does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in production configurations.

ForgeRock does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. ForgeRock disclaims all warranties, expressed or implied, and in particular, disclaims all warranties of merchantability, and warranties related to the code, or any service or software related thereto.

ForgeRock shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.

Project Information