This is an empty Spring Boot application. It can be used to run the Hdiv Agent in remote so it can be used from a web page or application (from now, client application) to detect Untrusted Client Access attacks.
It's an Spring Boot application, so it can be executed form an IDE (ideally, Spring Tool Suite) or from the command line.
Add the Hdiv Agent location adding the following line under VM arguments
-javaagent:{path-to-hdiv-folder}/hdiv-ee-agent.jar
For example
-javaagent:/Users/develop/hdiv/hdiv-ee-agent.jar
Add the following options using Java system properties for a proper execution of the agent.
- hdiv.console.url: Url of the Hdiv Console application. For example, https://consoleserver/hdiv-console-services
- hdiv.console.token: Token of the environment in the Hdiv Console associated with the client application. For example 6a367E2eb97db59020a47340
- hdiv.server.name: Name of the server that runs the client application. For example, Test-Server
- hdiv.config.dir: Path to the directory where the Hdiv license is present. For example, /Users/develop/hdiv/
- hdiv.base.internal.url: Base path to get the script file form the Hdiv Agent. The suggested value is assets
- hdiv.multiple.filter: Set this property to true to use the Context Path of the script file as the name of the client application.
For example
-javaagent:/Users/develop/hdiv/hdiv-ee-agent.jar
-Dhdiv.console.url=https://consoleserver/hdiv-console-services
-Dhdiv.console.token=6a367E2eb97db59020a47340
-Dhdiv.server.name=Test-Server
-Dhdiv.config.dir=/Users/develop/hdiv/
-Dhdiv.base.internal.url=assets
-Dhdiv.multiple.filter=true
Add other configuration options for the Java Agent if its needed
To run the application from the command line, first compile the application with the command
mvn clean install
Then, run the application with a command similar to this, changing the values of the properties for the real values
java -javaagent:/Users/develop/hdiv/hdiv-ee-agent.jar -Dhdiv.console.url=https://consoleserver/hdiv-console-services -Dhdiv.console.token=6a367E2eb97db59020a47340 -Dhdiv.server.name=Test-Server -Dhdiv.config.dir=/Users/develop/hdiv/ -Dhdiv.base.internal.url=assets -Dhdiv.multiple.filter=true -jar target/standalone-agent-app-0.0.1-SNAPSHOT.jar
To use the agent through the standalone agent app from a client application, you must include a javascript file of the agent in every page that must be analyzed. This reference must be the first javascript file included in the page.
The script tag used must have these form
<script src="https://${SERVER}/${APP}/${CONTEXT}/uca/static/${FILENAME}.js" type="text/javascript" ></script>
where
- ${SERVER}: Name of the server that runs this application. For example, scripts.demo.com.
- ${APP}: Name of the client application. For example, myapp
- ${CONTEXT}: Value of the property hdiv.base.internal.url. The suggested value for this property is assets
- ${FILENAME}: Name of the file. It can take any value, for example, main.js
For example
<script src="https://scripts.demo.com/myapp/assets/uca/static/main.js" type="text/javascript"></script>