Plugin Model
The SafeNet App Gateway agent provides a plugin model to modify the request before sending it to the protected application. The plugin model provides an interface that can be implemented to modify header, cookie, params, and form body before sending the request to the protected application.
Use case for a sample custom plugin file
A sample custom plugin lua file and an HTML template are provided here which can be used to support the following use case scenario for the form-based authentication.
In some scenarios, application access may require extra user attributes (for example, csrfToken) to provide an additional layer of security. In such scenarios, the SafeNet App Gateway agent uses the custom lua scripts to fetch csrfToken from the HTML <body> before authentication and bundles it with other attributes as part of the POST Call (forwarding response to the protected application) during authentication.
Detailed steps to configure the CSRF token for SafeNet App Gateway are mentioned here.
Perform the following steps to use the custom plugin model:
-
Create a clone of the sample plugin lua file and HTML template available here.
-
The sample plugin lua file can be used to modify the request at the agent side. In the sample plugin lua file:
-
Modify the interface methods to add customization as per your application. Refer to the sample plugin file for the interface methods details.
-
Provide the friendly app name in the getAppFriendlyName method. You can find the friendly app name in the downloaded agent configuration file.
-
-
The HTML template contains the form element used to send the login details to the SafeNet App Gateway agent. It can be used to modify the login request using Javascript within the browser. In the HTML template,
-
The form action URL must be set to {LoginUrl}. It will be automatically replaced by the agent with the Login URL (as configured in STA application template).
-
You can update the submitform Javascript method to modify the request before the form is submitted.
-
-
Mount the folder that contains the custom plugin scripts as docker volume in the SafeNet App Gateway custom plugin folder (/usr/local/thales/safeNetApplicationGateway/src/customPlugins).
In the docker compose file, there is a field named volumes (commented), which mounts the custom plugin files to the docker container. The user can uncomment it and then modify the location to load the custom plugin files to the docker container.