diff --git a/IdentityServer/v6/docs/content/bff/extensibility/tokens.md b/IdentityServer/v6/docs/content/bff/extensibility/tokens.md index 99ab86a5..4f1b1854 100644 --- a/IdentityServer/v6/docs/content/bff/extensibility/tokens.md +++ b/IdentityServer/v6/docs/content/bff/extensibility/tokens.md @@ -31,23 +31,24 @@ If you do not use server-side sessions, then the access and refresh token will b This would involve two steps * turn off the *SaveTokens* flag on the OpenID Connect handler and handle the relevant events manually to store the tokens in your custom store -* implement and register the *IdentityModel.AspNetCore.AccessTokenManagement.IUserAccessTokenStore* interface +* implement and register the *Duende.AccessTokenManagement.IUserTokenStore* interface The interface is responsible to storing, retrieving and clearing tokens for the automatic token management: ```cs -public interface IUserAccessTokenStore +public interface IUserTokenStore { /// /// Stores tokens /// /// User the tokens belong to - /// The access token - /// The access token expiration - /// The refresh token (optional) + /// /// Extra optional parameters /// - Task StoreTokenAsync(ClaimsPrincipal user, string accessToken, DateTimeOffset expiration, string refreshToken = null, UserAccessTokenParameters parameters = null); + Task StoreTokenAsync( + ClaimsPrincipal user, + UserToken token, + UserTokenRequestParameters? parameters = null); /// /// Retrieves tokens from store @@ -55,7 +56,9 @@ public interface IUserAccessTokenStore /// User the tokens belong to /// Extra optional parameters /// access and refresh token and access token expiration - Task GetTokenAsync(ClaimsPrincipal user, UserAccessTokenParameters parameters = null); + Task GetTokenAsync( + ClaimsPrincipal user, + UserTokenRequestParameters? parameters = null); /// /// Clears the stored tokens for a given user @@ -63,7 +66,9 @@ public interface IUserAccessTokenStore /// User the tokens belong to /// Extra optional parameters /// - Task ClearTokenAsync(ClaimsPrincipal user, UserAccessTokenParameters parameters = null); + Task ClearTokenAsync( + ClaimsPrincipal user, + UserTokenRequestParameters? parameters = null); } ``` diff --git a/IdentityServer/v6/docs/content/tokens/refresh.md b/IdentityServer/v6/docs/content/tokens/refresh.md index 45b7b4ab..aa92e68c 100644 --- a/IdentityServer/v6/docs/content/tokens/refresh.md +++ b/IdentityServer/v6/docs/content/tokens/refresh.md @@ -45,7 +45,7 @@ var response = await client.RequestRefreshTokenAsync(new RefreshTokenRequest }); ``` -The [IdentityModel.AspNetCore](https://identitymodel.readthedocs.io/en/latest/aspnetcore/web.html) library can be used to automate refresh & access token lifetime management in ASP.NET Core. +The [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) library can be used to automate refresh & access token lifetime management in ASP.NET Core. ## Refresh token security considerations Refresh tokens are a high-value target for attackers, because they typically have a much higher lifetime than access tokens. diff --git a/IdentityServer/v7/docs/content/bff/extensibility/tokens.md b/IdentityServer/v7/docs/content/bff/extensibility/tokens.md index 99ab86a5..4f1b1854 100644 --- a/IdentityServer/v7/docs/content/bff/extensibility/tokens.md +++ b/IdentityServer/v7/docs/content/bff/extensibility/tokens.md @@ -31,23 +31,24 @@ If you do not use server-side sessions, then the access and refresh token will b This would involve two steps * turn off the *SaveTokens* flag on the OpenID Connect handler and handle the relevant events manually to store the tokens in your custom store -* implement and register the *IdentityModel.AspNetCore.AccessTokenManagement.IUserAccessTokenStore* interface +* implement and register the *Duende.AccessTokenManagement.IUserTokenStore* interface The interface is responsible to storing, retrieving and clearing tokens for the automatic token management: ```cs -public interface IUserAccessTokenStore +public interface IUserTokenStore { /// /// Stores tokens /// /// User the tokens belong to - /// The access token - /// The access token expiration - /// The refresh token (optional) + /// /// Extra optional parameters /// - Task StoreTokenAsync(ClaimsPrincipal user, string accessToken, DateTimeOffset expiration, string refreshToken = null, UserAccessTokenParameters parameters = null); + Task StoreTokenAsync( + ClaimsPrincipal user, + UserToken token, + UserTokenRequestParameters? parameters = null); /// /// Retrieves tokens from store @@ -55,7 +56,9 @@ public interface IUserAccessTokenStore /// User the tokens belong to /// Extra optional parameters /// access and refresh token and access token expiration - Task GetTokenAsync(ClaimsPrincipal user, UserAccessTokenParameters parameters = null); + Task GetTokenAsync( + ClaimsPrincipal user, + UserTokenRequestParameters? parameters = null); /// /// Clears the stored tokens for a given user @@ -63,7 +66,9 @@ public interface IUserAccessTokenStore /// User the tokens belong to /// Extra optional parameters /// - Task ClearTokenAsync(ClaimsPrincipal user, UserAccessTokenParameters parameters = null); + Task ClearTokenAsync( + ClaimsPrincipal user, + UserTokenRequestParameters? parameters = null); } ``` diff --git a/IdentityServer/v7/docs/content/samples/basics.md b/IdentityServer/v7/docs/content/samples/basics.md index b2762636..cec30763 100644 --- a/IdentityServer/v7/docs/content/samples/basics.md +++ b/IdentityServer/v7/docs/content/samples/basics.md @@ -59,15 +59,15 @@ Key takeaways: [link to source code]({{< param samples_base >}}/Basics/MvcBasic) ### MVC Client with automatic Access Token Management -This sample shows how to use [IdentityModel.AspNetCore](https://identitymodel.readthedocs.io/en/latest/aspnetcore/overview.html) to automatically manage access tokens. +This sample shows how to use [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) to automatically manage access tokens. -The sample uses a special client ID in the sample IdentityServer with a short token lifetime (75 seconds). When repeating the API call, make sure you inspect the returned *iat* and *exp* claims to observer how the token is slides. +The sample uses a special client in the sample IdentityServer with a short token lifetime (75 seconds). When repeating the API call, make sure you inspect the returned *iat* and *exp* claims to observer how the token is slides. You can also turn on debug tracing to get more insights in the token management library. Key takeaways: -* use IdentityModel.AspNetCore to automate refreshing tokens +* use Duende.AccessTokenManagement to automate refreshing tokens [link to source code]({{< param samples_base >}}/Basics/MvcTokenManagement) diff --git a/IdentityServer/v7/docs/content/tokens/refresh.md b/IdentityServer/v7/docs/content/tokens/refresh.md index 45b7b4ab..aa92e68c 100644 --- a/IdentityServer/v7/docs/content/tokens/refresh.md +++ b/IdentityServer/v7/docs/content/tokens/refresh.md @@ -45,7 +45,7 @@ var response = await client.RequestRefreshTokenAsync(new RefreshTokenRequest }); ``` -The [IdentityModel.AspNetCore](https://identitymodel.readthedocs.io/en/latest/aspnetcore/web.html) library can be used to automate refresh & access token lifetime management in ASP.NET Core. +The [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) library can be used to automate refresh & access token lifetime management in ASP.NET Core. ## Refresh token security considerations Refresh tokens are a high-value target for attackers, because they typically have a much higher lifetime than access tokens. diff --git a/IdentityServer/v7/docs/content/tokens/requesting.md b/IdentityServer/v7/docs/content/tokens/requesting.md index a8b4cc5f..09cc580a 100644 --- a/IdentityServer/v7/docs/content/tokens/requesting.md +++ b/IdentityServer/v7/docs/content/tokens/requesting.md @@ -64,7 +64,7 @@ var response = await client.RequestClientCredentialsTokenAsync(new ClientCredent ``` ### Automating token requests in ASP.NET Core and Worker applications -The [IdentityModel.AspNetCore](https://identitymodel.readthedocs.io/en/latest/aspnetcore/worker.html) library can automate client credential request and token lifetime management for you. +The [Duende.AccessTokenManagement](https://github.com/DuendeSoftware/Duende.AccessTokenManagement/wiki) library can automate client credential request and token lifetime management for you. Using this library, you only need to register the token client in DI: @@ -220,4 +220,4 @@ public void ConfigureServices(IServiceCollection services) ``` ### Automating token management in ASP.NET Core -The [IdentityModel.AspNetCore](https://identitymodel.readthedocs.io/en/latest/aspnetcore/web.html) library can also be used to automate token lifetime management in ASP.NET Core applications for you. +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.