Skip to content

Commit e208151

Browse files
committed
Various updates
1 parent 05e3b60 commit e208151

File tree

8 files changed

+68
-64
lines changed

8 files changed

+68
-64
lines changed

src/content/docs/accesstokenmanagement/advanced/client-assertions.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ redirect_from:
99
---
1010
import { Tabs, TabItem } from "@astrojs/starlight/components";
1111

12-
If your token client is using a client assertion instead of a shared secret, you can provide the assertion in two ways
12+
If your token client is using a client assertion instead of a shared secret, you can provide the assertion in two ways:
1313

14-
* use the request parameter mechanism to pass a client assertion to the management
15-
* implement the `IClientAssertionService` interface to centralize client assertion creation
14+
* Use the request parameter mechanism to pass a client assertion to the management
15+
* Implement the `IClientAssertionService` interface to centralize client assertion creation
1616

1717
Here's a sample client assertion service using the Microsoft JWT library:
1818

19-
2019
{/* prettier-ignore */}
2120
<Tabs syncKey="atm">
2221
{/* prettier-ignore */}

src/content/docs/accesstokenmanagement/advanced/client-credentials.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ redirect_from:
99
---
1010
import { Tabs, TabItem } from "@astrojs/starlight/components";
1111

12-
The most common way to use the access token management for [machine-to-machine communication](/accesstokenmanagement/workers) - however, you may want to customize certain aspects of it. Here's what you can do.
12+
The most common way to use the access token management for [machine-to-machine communication](/accesstokenmanagement/workers).
13+
However, you may want to customize certain aspects of it.
1314

1415
## Client Options
1516

src/content/docs/accesstokenmanagement/advanced/dpop.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ redirect_from:
88
- /foss/accesstokenmanagement/advanced/dpop/
99
---
1010

11-
[DPoP](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop) specifies how to bind an asymmetric key stored within a JSON Web Key (JWK) to an access token. This will make the access token bound to the key such that if the access token were to leak, it cannot be used without also having access to the private key of the corresponding JWK.
11+
[DPoP](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop) specifies how to bind an asymmetric key stored within a JSON Web Key (JWK) to an access token.
12+
This will make the access token bound to the key such that if the access token were to leak, it cannot be used without also having access to the private key of the corresponding JWK.
1213

13-
The "Duende.AccessTokenManagement" library supports DPoP.
14+
The Duende.AccessTokenManagement library supports DPoP.
1415

1516
## DPoP Key
1617

17-
The main piece that your hosting application needs to concern itself with is how to obtain (and manage) the DPoP key. This key (and signing algorithm) will be either an "RS", "PS", or "ES" style key, and needs to be in the form of a JSON Web Key (or JWK). Consult the specification for more details.
18+
The main piece that your hosting application needs to concern itself with is how to get (and manage) the DPoP key. This key (and signing algorithm) will be either an "RS", "PS", or "ES" style key, and needs to be in the form of a JSON Web Key (or JWK). Consult the specification for more details.
1819

1920
The creation and management of this DPoP key is up to the policy of the client. For example is can be dynamically created when the client starts up, and can be periodically rotated. The main constraint is that it must be stored for as long as the client uses any access tokens (and possibly refresh tokens) that they are bound to, which this library will manage for you.
2021

@@ -73,11 +74,11 @@ When using DPoP and `AddOpenIdConnectAccessTokenManagement`, this library will a
7374

7475
## Proof Tokens At The API
7576

76-
Once the library has obtained a DPoP bound access token for the client, then if your application is using any of the `HttpClient` client factory helpers (e.g. `AddClientCredentialsHttpClient` or `AddUserAccessTokenHttpClient`) then those outbound HTTP requests will automatically include a DPoP proof token for the associated DPoP access token.
77+
Once the library has gotten a DPoP bound access token for the client, then if your application is using any of the `HttpClient` client factory helpers (e.g. `AddClientCredentialsHttpClient` or `AddUserAccessTokenHttpClient`) then those outbound HTTP requests will automatically include a DPoP proof token for the associated DPoP access token.
7778

7879
## Considerations
7980

8081
A point to keep in mind when using DPoP and `AddOpenIdConnectAccessTokenManagement` is that the DPoP proof key is created per user session.
8182
This proof key must be store somewhere, and the `AuthenticationProperties` used by both the OIDC and cookie handlers is what is used to store this key.
8283
This implies that the OIDC `state` parameter will increase in size, as well the resultant cookie that represents the user's session.
83-
The storage of each of these can be customized with the properties on the options `StateDataFormat` and `SessionStore` respectively.
84+
The storage for each of these can be customized with the properties on the options `StateDataFormat` and `SessionStore` respectively.

src/content/docs/accesstokenmanagement/blazor-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This means:
1919

2020
Fortunately, `Duende.AccessTokenManagement` provides a straightforward solution to these problems. Also see the [*BlazorServer* sample](https://github.com/DuendeSoftware/foss/tree/main/access-token-management/samples/BlazorServer) for source code of a full example.
2121

22-
## Token storage
22+
## Token Storage
2323

2424
Since the tokens cannot be managed in the authentication session, you need to store them somewhere else. The options include an in-memory data structure, a distributed cache like redis, or a database. Duende.AccessTokenManagement describes this store for tokens with the *IUserTokenStore* interface. In non-blazor scenarios, the default implementation that stores the tokens in the session is used. In your Blazor server application, you'll need to decide where you want to store the tokens and implement the store interface.
2525

src/content/docs/accesstokenmanagement/index.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ import { CardGrid, LinkCard } from "@astrojs/starlight/components";
1212

1313
The `Duende.AccessTokenManagement` library provides automatic access token management features for .NET worker and ASP.NET Core web applications:
1414

15-
- automatic acquisition and lifetime management of client credentials based access tokens for machine-to-machine communication (using the `Duende.AccessTokenManagement` package)
16-
- automatic access token lifetime management using a refresh token for API calls on behalf of the currently logged-in user (using the `Duende.AccessTokenManagement.OpenIdConnect` package)
17-
- revocation of access tokens
15+
- Automatic acquisition and lifetime management of client credentials based access tokens for machine-to-machine communication (using the `Duende.AccessTokenManagement` package)
16+
- Automatic access token lifetime management using a refresh token for API calls on behalf of the currently logged-in user (using the `Duende.AccessTokenManagement.OpenIdConnect` package)
17+
- Revocation of access tokens
1818

19-
:::note
20-
Duende.AccessTokenManagement version 4 (currently in preview 2) brings significant improvements, but also several breaking
21-
changes. Please see the [migration guide](/accesstokenmanagement/upgrading/atm-v3-to-v4/) and [release notes](https://github.com/DuendeSoftware/foss/releases/tag/atm-4.0.0-Preview.2).
19+
:::note[Duende.AccessTokenManagement version 4 preview]
20+
Duende.AccessTokenManagement version 4 (preview) brings significant improvements, but also several breaking
21+
changes. Please see the [migration guide](/accesstokenmanagement/upgrading/atm-v3-to-v4/) and [release notes](https://github.com/DuendeSoftware/foss/releases/tag/atm-4.0.0-Preview.2).
2222
:::
23-
2423

25-
## Machine-to-machine token management
24+
## Machine-To-Machine Token Management
2625

2726
To get started, install the NuGet Package:
2827

@@ -45,7 +44,7 @@ See [Service Workers and Background Tasks](/accesstokenmanagement/workers.md) fo
4544
/>
4645
</CardGrid>
4746

48-
## User token management
47+
## User Token Management
4948

5049
To get started, install the NuGet Package:
5150

@@ -68,6 +67,7 @@ See [Web Applications](/accesstokenmanagement/web-apps.md) for more information
6867
/>
6968
</CardGrid>
7069

71-
## License and Feedback
70+
## License And Feedback
7271

73-
**Duende.AccessTokenManagement** is released as open source under the Apache 2.0 license. Bug reports, feature requests and contributions are welcome. If you have an idea for a new feature or significant code change you'd like to propose, please start with a GitHub issue so that we can discuss it. Thanks in advance!
72+
**Duende.AccessTokenManagement** is released as open source under the Apache 2.0 license.
73+
Bug reports, feature requests and contributions are welcome via the [Duende community discussions](https://duende.link/community).

src/content/docs/accesstokenmanagement/upgrading/atm-v3-to-v4.mdx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
title: "Duende AccessTokenManagement v3.x to v4.0"
3-
description: Guide for upgrading Duende BFF Security Framework from version 3.x to version 4.0, including migration steps for custom implementations and breaking changes.
3+
description: Guide for upgrading Duende.AccessTokenManagement from version 3.x to version 4.0, including migration steps for custom implementations and breaking changes.
44
sidebar:
55
label: v3.x → v4.0
66
order: 100
77
---
88

99
## Changes
10-
### Moving Towards HybridCache Implementation and Away from Distributed Cache
1110

12-
Microsoft has recently released HybridCache. While this is only released as a .NET 9 DLL, these assemblies work fine in .NET 8. So, while we still support .NET 8 with ATM 4.0, we are moving towards using HybridCache.
11+
### Moving Towards HybridCache Implementation And Away from Distributed Cache
12+
13+
Microsoft has recently released [HybridCache](https://learn.microsoft.com/en-us/aspnet/core/performance/caching/hybrid). While this is only released as a .NET 9 assembly, these assemblies work fine in .NET 8. So, while we still support .NET 8 with ATM 4.0, we are moving towards using HybridCache.
1314

1415
HybridCache brings significant improvements for us. Because of the two-layered cache, we've found it significantly improves performance.
1516
If you currently use a distributed cache, this should still work seamlessly.
@@ -31,9 +32,11 @@ The library has undergone extensive internal changes—so much so that it can be
3132

3233
All internal implementation details are now marked as internal, reducing accidental coupling and clarifying the intended extension points. In V3, all classes were public and most public methods were marked as virtual. This meant you could override any class by inheriting from it and overriding a single method.
3334

34-
While this was very convenient for our consumers, it made it very difficult for us to introduce changes to the library without making breaking changes.
35+
While this was very convenient for our consumers, it made it challenging to introduce changes to the library without making breaking changes.
3536

36-
We still want to ensure our users' extensibility needs are met, but via more controlled mechanisms. If you find that you have an extensibility need that is not covered by the new model, please raise a discussion in our discussion board. If this is a scenario we want to support, we'll do our best to accommodate it.
37+
We still want to ensure our users' extensibility needs are met, but via more controlled mechanisms.
38+
If you find that you have an extensibility need not covered by the new model, please raise a discussion [in our discussion board](https://duende.link/community).
39+
If this is a scenario we want to support, we'll do our best to accommodate it.
3740

3841
### Explicit Extension Model
3942

@@ -55,15 +58,15 @@ For example:
5558

5659
```csharp
5760
var scheme = Scheme.Parse("oidc");
58-
5961
```
6062

6163
### Renamed classes
62-
Several classes have been renamed, either to make their usage clearer or to drop the 'service' suffix, which only adds noise:
63-
64-
AccessTokenHandler => AccessTokenRequestHandler
65-
ClientCredentialsTokenManagementService => IClientIClientCredentialsTokenManager
66-
IClientCredentialsTokenEndpointService => IClientCredentialsTokenEndpoint
67-
IUserTokenManagementService => IUserTokenManager
68-
ITokenRequestSynchronization => IUserTokenRequestConcurrencyControl
69-
IUserTokenEndpointService => IUserTokenEndpoint
64+
65+
Several classes have been renamed, either to clarify their usage or to drop the `service` suffix, which only adds noise:
66+
67+
* `AccessTokenHandler` is now `AccessTokenRequestHandler`
68+
* `ClientCredentialsTokenManagementService` is now `IClientIClientCredentialsTokenManager`
69+
* `IClientCredentialsTokenEndpointService` is now `IClientCredentialsTokenEndpoint`
70+
* `IUserTokenManagementService` is now `IUserTokenManager`
71+
* `ITokenRequestSynchronization` is now `IUserTokenRequestConcurrencyControl`
72+
* `IUserTokenEndpointService` is now `IUserTokenEndpoint`

src/content/docs/accesstokenmanagement/web-apps.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ While many of the details can be customized, by default the following is assumed
1616

1717
* ASP.NET Core web application
1818
* cookie authentication handler for session management
19-
* OpenID Connect authentication handler for authentication and access token requests against an OpenID Connect compliant
20-
token service
19+
* OpenID Connect authentication handler for authentication and access token requests against an OpenID Connect compliant token service
2120
* the token service returns a refresh token
2221

23-
Using this library, you can either request `user access tokens` or `client credentials tokens`. User access tokens typically contain information about the currently logged in user, such as the `sub` claim. They are used to access services under the credentials of the currently logged in user. `Client credentials tokens` do not contain information about the currently logged in user and are typically used to do machine-to-machine calls.
22+
Using this library, you can either request `user access tokens` or `client credentials tokens`. User access tokens typically contain information about the currently logged in user, such as the `sub` claim.
23+
They are used to access services under the credentials of the currently logged in user. `Client credentials tokens` do not contain information about the currently logged in user and are typically used to do machine-to-machine calls.
2424

25-
## Usage
26-
First, you'll need to add `Duende.AccessTokenManagement.OpenIdConnect` to your solution.
25+
To get started, you'll need to add `Duende.AccessTokenManagement.OpenIdConnect` to your solution.
2726

2827
Then, there are two fundamental ways to interact with token management:
2928
1. **Automatic** <Badge text="recommended"/>: You request a http client from the IHTTPClientFactory. This http client automatically requests, optionally renews and attaches the access tokens on each request.
3029
2. **Manually** <Badge text="advanced"/>: You request an access token, which you can then use to (for example) authenticate with services. You are responsible for attaching the access token to requests.
3130

32-
### Adding AccessTokenManagement to your project
31+
Let's look at these steps in more detail.
3332

33+
## Adding AccessTokenManagement To Your Project
3434

3535
To use this library, start by adding the library to your .NET projects.
3636

3737
```bash
3838
dotnet add package Duende.AccessTokenManagement.OpenIdConnect
3939
```
4040

41-
By default, the token management library will use the ASP.NET Core default authentication scheme for token storage (this
42-
is typically the cookie handler and its authentication session), and the default challenge scheme for deriving token
43-
client configuration for refreshing tokens or requesting client credential tokens (this is typically the OpenID Connect
44-
handler pointing to your trusted authority).
41+
By default, the token management library will use the ASP.NET Core default authentication scheme for token storage.
42+
This is typically the cookie handler and its authentication session.
43+
It also used the default challenge scheme for deriving token client configuration for refreshing tokens or requesting
44+
client credential tokens (typically the OpenID Connect handler pointing to your trusted authority).
4545

4646
```csharp
4747
// Program.cs
@@ -100,10 +100,10 @@ builder.Services.AddAuthentication(options =>
100100
builder.Services.AddOpenIdConnectAccessTokenManagement();
101101
```
102102

103-
### Automatic via HTTP Client Factory
103+
## Automatic Via HTTP Client Factory
104104

105105
Similar to the worker service support, you can register HTTP clients that automatically send the access token of the
106-
current user when making API calls. The message handler plumbing associated with those HTTP clients will try to make
106+
current user when making API calls. The message handler associated with those HTTP clients will try to make
107107
sure, the access token is always valid and not expired.
108108

109109
```csharp
@@ -148,7 +148,7 @@ builder.Services.AddHttpClient<MasterDataClient>(client =>
148148

149149

150150
Last but not least, if you registered clients with the factory, you can use them. They will try to make sure that a
151-
current access token is always sent along. If that is not possible, ultimately a 401 will be returned to the calling
151+
current access token is always sent along. If that is not possible, ultimately a `401` HTTP status code will be returned to the calling
152152
code.
153153

154154
```csharp
@@ -173,9 +173,9 @@ public async Task<IActionResult> CallApi([FromServices] InvoiceClient client)
173173
}
174174
```
175175

176-
### Manually request access tokens
176+
## Manually Request Access Tokens
177177

178-
If you want to use access tokens in a different way or have more advanced needs which the automatic option doesn't cover, then you can also manually request user access tokens.
178+
If you want to use access tokens differently or have more advanced needs which the automatic option doesn't cover, then you can also manually request user access tokens.
179179

180180
{/* prettier-ignore */}
181181
<Tabs syncKey="atm">

0 commit comments

Comments
 (0)