The unprotected example is the base reference to build the Approov protected servers. This a very basic Hello World server.
To be the starting building block for the Approov protected servers, that will show you how to lock down your API server to your mobile app. Please read the brief summary in the Approov Overview at the root of this repo or visit our website for more details.
The Java Spring API server is very simple and only replies to the endpoint / with the message:
{"message": "Hello, World!"}You can find the endpoint definition here.
To run this example you will need to have installed:
- OpenJDK - This server example uses version
11.0.3. It should work with earlier or later versions but was not tested. - Java Spring - Version
2.6.4of the Spring Framework plugin is being used. The code should work with prior versions but wasn't tested.
First build the server with gradle. From the ./servers/hello/src/unprotected-server folder execute:
./gradlew buildNow, you can run this example from the ./servers/hello/src/unprotected-server folder with:
set -a # auto-export all assignments
source .env && ./gradlew bootRun
set +a # stop exporting variablesFinally, you can test that it works with:
curl -X GET 'http://localhost:8002'
The response will be:
{"message":"Hello, World!"}If you find any issue while following our instructions then just report it here, with the steps to reproduce it, and we will sort it out and/or guide you to the correct path.
If you wish to explore the Approov solution in more depth, then why not try one of the following links as a jumping off point: