Skip to content

Commit 156321d

Browse files
authored
Merge pull request #7 from approov/feature/message_signing
Feature/message signing
2 parents 0bab7ac + d2a7d91 commit 156321d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2921
-1384
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,5 @@ paket-files/
263263
__pycache__/
264264
*.pyc
265265

266-
.env
266+
".env"
267+
.DS_Store

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG TAG=6.0
1+
ARG TAG=8.0
22

33
FROM mcr.microsoft.com/dotnet/sdk:${TAG}
44

EXAMPLES.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,33 @@ If you are looking for the Approov quickstarts to integrate Approov in your ASP.
1212
To learn more about each Hello server example you need to read the README for each one at:
1313

1414
* [Unprotected Server](/servers/hello/src/unprotected-server)
15-
* [Approov Protected Server - Token Check](/servers/hello/src/approov-protected-server/token-check)
16-
* [Approov Protected Server - Token Binding Check](/servers/hello/src/approov-protected-server/token-binding-check)
15+
* [Approov Protected Server](/servers/hello/src/approov-protected-server/token-check)
1716

17+
The repository also includes helper scripts in `/test-scripts` that exercise token validation, token binding, message signing, and Structured Field parsing against the protected server.
1818

1919
## Setup Environment
2020

21-
Do not forget to properly setup the `.env` file in the root of each Approov protected server example before you run the server with the docker stack.
21+
Do not forget to properly setup the `.env` file in the root of the Approov protected server example before you run the server with the docker stack.
2222

2323
```bash
2424
cp servers/hello/src/approov-protected-server/token-check/.env.example servers/hello/src/approov-protected-server/token-check/.env
25-
cp servers/hello/src/approov-protected-server/token-binding-check/.env.example servers/hello/src/approov-protected-server/token-binding-check/.env
2625
```
2726

28-
Edit each file and add the [dummy secret](/TESTING.md#the-dummy-secret) to it in order to be able to test the Approov integration with the provided [Postman collection](https://github.com/approov/postman-collections/blob/master/quickstarts/hello-world/hello-world.postman_curl_requests_examples.md).
27+
Edit the file and add the [dummy secret](/TESTING.md#the-dummy-secret) to it in order to be able to test the Approov integration with the provided [Postman collection](https://github.com/approov/postman-collections/blob/master/quickstarts/hello-world/hello-world.postman_curl_requests_examples.md). Set `APPROOV_TOKEN_BINDING_HEADER` (for example `Authorization`) and tweak the optional `APPROOV_SIGNATURE_*` variables to explore token binding and message signing policies.
2928

3029

3130
## Docker Stack
3231

3332
The docker stack provided via the `docker-compose.yml` file in this folder is used for development proposes and if you are familiar with docker then feel free to also use it to follow along the examples on the README of each server.
3433

35-
If you decide to use the docker stack then you need to bear in mind that the Postman collections, used to test the servers examples, will connect to port `8002` therefore you cannot start all docker compose services at once, for example with `docker-compose up`, instead you need to run one at a time as exemplified below.
34+
If you decide to use the docker stack then you need to bear in mind that the Postman collections, used to test the servers examples, will connect to port `8111` therefore you cannot start all docker compose services at once, for example with `docker-compose up`, instead you need to run one at a time as exemplified below.
3635

3736
### Build the Docker Stack
3837

39-
The three services in the `docker-compose.yml` use the same Dockerfile, therefore to build the Docker image we just need to used one of them:
38+
The services in the `docker-compose.yml` use the same Dockerfile, therefore to build the Docker image we just need to use one of them:
4039

4140
```bash
42-
sudo docker-compose build approov-token-binding-check
41+
sudo docker-compose build approov-token-check
4342
```
4443

4544
Now, you are ready to start using the Docker stack for ASP.Net.
@@ -76,20 +75,6 @@ or get a bash shell inside the container:
7675
sudo docker-compose run --rm --service-ports approov-token-check zsh
7776
```
7877

79-
#### For the Approov Token Binding Check
80-
81-
Run the container attached to the shell:
82-
83-
```bash
84-
sudo docker-compose up approov-token-binding-check
85-
```
86-
87-
or get a bash shell inside the container:
88-
89-
```bash
90-
sudo docker-compose run --rm --service-ports approov-token-binding-check zsh
91-
```
92-
9378
## Issues
9479

9580
If you find any issue while following our instructions then just report it [here](https://github.com/approov/quickstart-asp.net-token-check/issues), with the steps to reproduce it, and we will sort it out and/or guide you to the correct path.
@@ -99,7 +84,7 @@ If you find any issue while following our instructions then just report it [here
9984

10085
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:
10186

102-
* [Approov Free Trial](https://approov.io/signup)(no credit card needed)
87+
* [Approov Free Trial](https://approov.io/signup) (no credit card needed)
10388
* [Approov Get Started](https://approov.io/product/demo)
10489
* [Approov QuickStarts](https://approov.io/docs/latest/approov-integration-examples/)
10590
* [Approov Docs](https://approov.io/docs)

OVERVIEW.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ The backend server ensures that the token supplied in the `Approov-Token` header
3333

3434
The request is handled such that:
3535

36-
* If the Approov Token is valid, the request is allowed to be processed by the API endpoint
37-
* If the Approov Token is invalid, an HTTP 401 Unauthorized response is returned
36+
* If the Approov Token is valid, the request is allowed to be processed by the API endpoint.
37+
* If the Approov Token is invalid, an HTTP 401 Unauthorized response is returned.
38+
* Optional [token binding](https://approov.io/docs/latest/approov-usage-documentation/#token-binding) recomputes the binding hash from headers such as `Authorization` and must match the token’s `pay` claim before the request is processed.
39+
* Optional [message signing](https://approov.io/docs/latest/approov-usage-documentation/#message-signing) reconstructs the canonical HTTP message and validates the signature supplied in the `Signature` / `Signature-Input` headers using the installation public key embedded in the token.
3840

3941
You can choose to log JWT verification failures, but we left it out on purpose so that you can have the choice of how you prefer to do it and decide the right amount of information you want to log.
4042

@@ -43,7 +45,7 @@ You can choose to log JWT verification failures, but we left it out on purpose s
4345

4446
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:
4547

46-
* [Approov Free Trial](https://approov.io/signup)(no credit card needed)
48+
* [Approov Free Trial](https://approov.io/signup) (no credit card needed)
4749
* [Approov Get Started](https://approov.io/product/demo)
4850
* [Approov QuickStarts](https://approov.io/docs/latest/approov-integration-examples/)
4951
* [Approov Docs](https://approov.io/docs)

QUICKSTARTS.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Approov Integration Quickstarts
22

3-
[Approov](https://approov.io) is an API security solution used to verify that requests received by your backend services originate from trusted versions of your mobile apps.
3+
[Approov](https://approov.io) ensures that API traffic reaching your backend originates from trusted versions of your mobile apps. This repository collects the server-side quickstarts for ASP.NET 8 and reuses a single reference implementation at `servers/hello/src/approov-protected-server/token-check`.
44

55

66
## The Quickstarts
77

8-
The quickstart code for the Approov backend server is split into two implementations. The first gets you up and running with basic token checking. The second uses a more advanced Approov feature, _token binding_. Token binding may be used to link the Approov token with other properties of the request, such as user authentication (more details can be found [here](https://approov.io/docs/latest/approov-usage-documentation/#token-binding)).
9-
* [Approov token check quickstart](/docs/APPROOV_TOKEN_QUICKSTART.md)
10-
* [Approov token check with token binding quickstart](/docs/APPROOV_TOKEN_BINDING_QUICKSTART.md)
8+
Pick the guide that matches the level of protection you want to implement:
119

12-
Both the quickstarts are built from the unprotected example server defined [here](servers/hello/src/unprotected-server).
10+
- [Approov token check](docs/APPROOV_TOKEN_QUICKSTART.md) - validate the JWT presented in the `Approov-Token` header.
11+
- [Approov token binding](docs/APPROOV_TOKEN_BINDING_QUICKSTART.md) - bind tokens to headers such as `Authorization` to prevent replay.
12+
- [Approov message signing](docs/APPROOV_MESSAGE_SIGNING_QUICKSTART.md) - verify HTTP message signatures using the installation public key (IPK).
13+
14+
Each build upon the previous one, so start with the token quickstart before layering binding or message signing.
1315

1416

1517
## Issues
@@ -21,13 +23,13 @@ If you find any issue while following our instructions then just report it [here
2123

2224
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:
2325

24-
* [Approov Free Trial](https://approov.io/signup)(no credit card needed)
25-
* [Approov Get Started](https://approov.io/product/demo)
26-
* [Approov QuickStarts](https://approov.io/docs/latest/approov-integration-examples/)
27-
* [Approov Docs](https://approov.io/docs)
28-
* [Approov Blog](https://approov.io/blog/)
29-
* [Approov Resources](https://approov.io/resource/)
30-
* [Approov Customer Stories](https://approov.io/customer)
31-
* [Approov Support](https://approov.io/contact)
32-
* [About Us](https://approov.io/company)
33-
* [Contact Us](https://approov.io/contact)
26+
- [Approov Free Trial](https://approov.io/signup) (no credit card needed)
27+
- [Approov Get Started](https://approov.io/product/demo)
28+
- [Approov QuickStarts](https://approov.io/docs/latest/approov-integration-examples/)
29+
- [Approov Docs](https://approov.io/docs)
30+
- [Approov Blog](https://approov.io/blog/)
31+
- [Approov Resources](https://approov.io/resource/)
32+
- [Approov Customer Stories](https://approov.io/customer)
33+
- [Approov Support](https://approov.io/contact)
34+
- [About Us](https://approov.io/company)
35+
- [Contact Us](https://approov.io/contact)

0 commit comments

Comments
 (0)