Skip to content

Commit 86fb52d

Browse files
committed
Applied changes based on suggestions/comments
1 parent 98ed7b7 commit 86fb52d

File tree

1 file changed

+16
-6
lines changed
  • src/content/docs/identitymodel-oidcclient/advanced

1 file changed

+16
-6
lines changed

src/content/docs/identitymodel-oidcclient/advanced/dpop.mdx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ The `Duende.IdentityModel.OidcClient.Extensions` library adds supports for DPoP
1414

1515
## DPoP Key
1616

17-
Before we begin, your application needs to have a DPoP key, in the form of a
17+
Before we begin, your application needs to have a DPoP key in the form of a
1818
JSON Web Key (or JWK). According to the [DPoP specification][dpop-spec], this
1919
key needs to use an asymmetric algorithm ("RS", "ES", or "PS" style).
2020

2121
:::note
22-
This means that the client application is responsible for creating the DPoP key,
22+
The client application is responsible for creating the DPoP key,
2323
rotating it, and managing its lifetime. For as long as there are access tokens
2424
(and possibly refresh tokens) bound to a DPoP key, that key needs to remain
2525
available to the client application.
2626
:::
2727

28-
Creating a JWK in .NET is pretty straightforward using the `Duende.IdentityModel.OidcClient.Extensions` library:
28+
You can create a JWK in .NET using the `Duende.IdentityModel.OidcClient.Extensions` library.
29+
The `JsonWebKeys` class has several static methods to help with creating JWKs using various algorithms.
2930

3031
```csharp
3132
// Program.cs
@@ -39,12 +40,18 @@ Console.WriteLine(jwk);
3940

4041
:::caution
4142
In a production scenario, you'll want to store this JWK in a secure location
42-
and use DataProtection to further protect the JWK.
43+
and use ASP.NET's [data protection](https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/) to further
44+
protect the JWK. See [our data protection guide](/identityserver/deployment#aspnet-core-data-protection) for more
45+
information.
4346
:::
4447

4548
## Initializing the OIDC client with DPoP support
4649

47-
Now that we have a JWK, we need to extend the `OidcClientOptions` to configure DPoP:
50+
We will need to extend the `OidcClientOptions` before we can use DPoP.
51+
52+
After creating the `OidcClientOptions`
53+
to connect our client application with the Identity Provider, we retrieve a JWK to use for DPoP, and add that JWK
54+
to our `options` by calling the `ConfigureDPoP` extension method:
4855

4956
```csharp
5057
// Program.cs
@@ -70,13 +77,16 @@ var oidcClient = new OidcClient(options);
7077

7178
## Proof Tokens for the API
7279

73-
After configuring the `OidcClientOptions` with DPoP support and creating an
80+
Now that we've configured the `OidcClientOptions` with DPoP support and created an
7481
`OidcClient` instance, you can use this instance to create an `HttpMessageHandler` which
7582
will:
7683

7784
- manage access and refresh tokens
7885
- add DPoP proof tokens to HTTP requests
7986

87+
The `OidcClient` provides `CreateDPoPHandler` as a convenience method to create such a handler,
88+
which can be used with the .NET `HttpClient`.
89+
8090
```csharp
8191
// Program.cs
8292
var sessionRefreshToken = "..."; // read from a previous session, if any

0 commit comments

Comments
 (0)