You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once the key has been configured for the client, then the library will use it to produce a DPoP proof token when calling the token server (including token renewals if relevant).
58
58
There is nothing explicit needed on behalf of the developer using this library.
59
59
60
-
### `dpop_jkt` At The token Server's Authorize Endpoint
60
+
### `dpop_jkt` At The Token Server's Authorize Endpoint
61
61
62
62
When using DPoP and `AddOpenIdConnectAccessTokenManagement`, this library will also automatically include the `dpop_jkt` parameter to the authorize endpoint.
IdentityServer can [bind tokens to clients](/identityserver/tokens/pop.md#proof-of-possession-styles) using either mTLS or DPoP, creating a `Proof-of-Possession` (PoP) access token. When one of these mechanisms is used, APIs that use those access tokens for authorization need to validate the binding between the client and token. This document describes how to perform such validation, depending on which mechanism was used to produce a PoP token.
13
+
IdentityServer can [bind tokens to clients](/identityserver/tokens/pop.md#proof-of-possession-styles) using either mTLS or
14
+
DPoP, creating a `Proof-of-Possession` (PoP) access token. When one of these mechanisms is used, APIs that use those
15
+
access tokens for authorization need to validate the binding between the client and token. This document describes how
16
+
to perform such validation, depending on which mechanism was used to produce a PoP token.
14
17
15
18
### Validating mTLS
16
19
17
-
If you are using a [mutual TLS connection](/identityserver/tokens/pop#mutual-tls) to establish proof-of-possession, the resulting access token will contain a `cnf` claim containing the client's certificate thumbprint. APIs validate such tokens by comparing this thumbprint to the thumbprint of the client certificate in the mTLS connection. This validation should be performed early in the pipeline, ideally immediately after the standard validation of the access token.
20
+
If you are using a [mutual TLS connection](/identityserver/tokens/pop#mutual-tls) to establish proof-of-possession, the
21
+
resulting access token will contain a `cnf` claim containing the client's certificate thumbprint. APIs validate such
22
+
tokens by comparing this thumbprint to the thumbprint of the client certificate in the mTLS connection. This validation
23
+
should be performed early in the pipeline, ideally immediately after the standard validation of the access token.
Here, `UseConfirmationValidation` is an extension method that registers the middleware that performs the necessary validation:
37
+
Here, `UseConfirmationValidation` is an extension method that registers the middleware that performs the necessary
38
+
validation:
32
39
33
40
```cs
34
41
publicstaticclassConfirmationValidationExtensions
@@ -109,11 +116,31 @@ public class ConfirmationValidationMiddlewareOptions
109
116
```
110
117
111
118
### Validating DPoP
112
-
If you are using [DPoP](/identityserver/tokens/pop) for proof-of-possession, there is a non-trivial amount of work needed to validate the `cnf` claim.
113
-
In addition to the normal validation mechanics of the access token itself, DPoP requires additional validation of the DPoP proof token sent in the "DPoP" HTTP request header.
114
-
DPoP proof token processing involves requiring the DPoP scheme on the authorization header where the access token is sent, JWT validation of the proof token, "cnf" claim validation, HTTP method and URL validation, replay detection (which requires some storage for the replay information), nonce generation and validation, additional clock skew logic, and emitting the correct response headers in the case of the various validation errors.
115
119
116
-
You can use the `Duende.AspNetCore.Authentication.JwtBearer` NuGet package to implement this validation. With this package, the configuration necessary in your startup can be as simple as this:
120
+
When using [DPoP](/identityserver/tokens/pop#enabling-dpop-in-identityserver) for proof-of-possession, validating the `cnf` claim requires several
121
+
steps:
122
+
123
+
1. Validating the access token as normal
124
+
2. Validating the DPoP proof token from the `DPoP` HTTP request header
125
+
3. Ensuring the authorization header uses the DPoP scheme
126
+
4. Validating the JWT format of the proof token
127
+
5. Verifying the `cnf` claim matches between tokens
128
+
6. Validating the HTTP method and URL match the request
129
+
7. Detecting replay attacks using storage
130
+
8. Managing nonce generation and validation
131
+
9. Handling clock skew between systems
132
+
10. Returning appropriate error response headers when validation fails
133
+
134
+
This comprehensive validation process requires careful implementation to ensure security. Luckily for
135
+
developers, we've implemented these steps into an easy-to-use library.
136
+
137
+
You can use the `Duende.AspNetCore.Authentication.JwtBearer` NuGet package to implement this validation.
Copy file name to clipboardExpand all lines: src/content/docs/identityserver/tokens/requesting.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ var response = await client.RequestClientCredentialsTokenAsync(new ClientCredent
71
71
72
72
### Automating Token Requests In ASP.NET Core And Worker Applications
73
73
74
-
The [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) library can automate client credential request and token lifetime management for you.
74
+
The [Duende.AccessTokenManagement](/accesstokenmanagement) library can automate client credential request and token lifetime management for you.
75
75
Using this library, you can enable access token management for an HTTP client provided by `IHttpClientFactory`.
76
76
77
77
You can add the necessary services to ASP.NET Core's service provider by calling `AddClientCredentialsTokenManagement()`. One or more named client definitions need to be registered by calling `AddClient()`.
The [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) library can also be used to automate token lifetime management in ASP.NET Core applications for you.
231
+
The [Duende.AccessTokenManagement](/accesstokenmanagement) library can also be used to automate token lifetime management in ASP.NET Core applications for you.
0 commit comments