From f705097df3f57126bd133735c6f9b6215f8ba6e6 Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Mon, 29 Apr 2024 20:29:47 -0500 Subject: [PATCH 1/2] Drop support for .NET 6/7 --- Directory.Build.targets | 8 -------- ...Duende.AccessTokenManagement.OpenIdConnect.csproj | 2 +- .../UserAccessTokenManagementService.cs | 12 ------------ .../Duende.AccessTokenManagement.csproj | 2 +- test/Tests/Framework/TestLoggerProvider.cs | 2 -- test/Tests/Tests.csproj | 2 +- 6 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index da21df5..65ae05e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -6,14 +6,6 @@ 7.0.4 - - 6.0.26 - 6.0.0 - 6.35.0 - 6.3.6 - - - diff --git a/src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj b/src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj index a9caec1..b2f063a 100644 --- a/src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj +++ b/src/Duende.AccessTokenManagement.OpenIdConnect/Duende.AccessTokenManagement.OpenIdConnect.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 enable true diff --git a/src/Duende.AccessTokenManagement.OpenIdConnect/UserAccessTokenManagementService.cs b/src/Duende.AccessTokenManagement.OpenIdConnect/UserAccessTokenManagementService.cs index a54465e..833bf29 100755 --- a/src/Duende.AccessTokenManagement.OpenIdConnect/UserAccessTokenManagementService.cs +++ b/src/Duende.AccessTokenManagement.OpenIdConnect/UserAccessTokenManagementService.cs @@ -19,11 +19,7 @@ public class UserAccessAccessTokenManagementService : IUserTokenManagementServic { private readonly IUserTokenRequestSynchronization _sync; private readonly IUserTokenStore _userAccessTokenStore; -#if NET8_0_OR_GREATER private readonly TimeProvider _clock; -#else - private readonly ISystemClock _clock; -#endif private readonly UserTokenManagementOptions _options; private readonly IUserTokenEndpointService _tokenEndpointService; private readonly ILogger _logger; @@ -40,11 +36,7 @@ public class UserAccessAccessTokenManagementService : IUserTokenManagementServic public UserAccessAccessTokenManagementService( IUserTokenRequestSynchronization sync, IUserTokenStore userAccessTokenStore, -#if NET8_0_OR_GREATER TimeProvider clock, -#else - ISystemClock clock, -#endif IOptions options, IUserTokenEndpointService tokenEndpointService, ILogger logger) @@ -100,11 +92,7 @@ public async Task GetAccessTokenAsync( } var dtRefresh = userToken.Expiration.Subtract(_options.RefreshBeforeExpiration); -#if NET8_0_OR_GREATER var utcNow = _clock.GetUtcNow(); -#else - var utcNow = _clock.UtcNow; -#endif if (dtRefresh < utcNow || parameters.ForceRenewal || needsRenewal) { _logger.LogDebug("Token for user {user} needs refreshing.", userName); diff --git a/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj b/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj index cc934c5..08b512b 100644 --- a/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj +++ b/src/Duende.AccessTokenManagement/Duende.AccessTokenManagement.csproj @@ -1,7 +1,7 @@  - net6.0;net8.0 + net8.0 enable true diff --git a/test/Tests/Framework/TestLoggerProvider.cs b/test/Tests/Framework/TestLoggerProvider.cs index f541ab9..d0837dc 100644 --- a/test/Tests/Framework/TestLoggerProvider.cs +++ b/test/Tests/Framework/TestLoggerProvider.cs @@ -23,9 +23,7 @@ public void Dispose() } public IDisposable BeginScope(TState state) -#if NET8_0_OR_GREATER where TState : notnull -#endif { return this; } diff --git a/test/Tests/Tests.csproj b/test/Tests/Tests.csproj index 5e61d3c..13d46d5 100644 --- a/test/Tests/Tests.csproj +++ b/test/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 enable enable From 10c31e5fe1aa8817d1ee36e6f15c949befc47138 Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Mon, 29 Apr 2024 23:30:04 -0500 Subject: [PATCH 2/2] Revert "Changed service registrations from Transient to Singleton." --- ...TokenManagementServiceCollectionExtensions.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Duende.AccessTokenManagement/ClientCredentialsTokenManagementServiceCollectionExtensions.cs b/src/Duende.AccessTokenManagement/ClientCredentialsTokenManagementServiceCollectionExtensions.cs index 2e17a1a..0d8c847 100644 --- a/src/Duende.AccessTokenManagement/ClientCredentialsTokenManagementServiceCollectionExtensions.cs +++ b/src/Duende.AccessTokenManagement/ClientCredentialsTokenManagementServiceCollectionExtensions.cs @@ -39,14 +39,14 @@ public static ClientCredentialsTokenManagementBuilder AddClientCredentialsTokenM { services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); - - services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); + services.TryAddTransient(); + services.TryAddTransient(); + services.TryAddTransient(); + services.TryAddTransient(); + + services.TryAddTransient(); + services.TryAddTransient(); + services.TryAddTransient(); services.AddHttpClient(ClientCredentialsTokenManagementDefaults.BackChannelHttpClientName);