diff --git a/conformance-report/src/ConformanceReport/IConformanceReportClientStore.cs b/conformance-report/src/ConformanceReport/IConformanceReportClientStore.cs index da7896d14..5b602b5c0 100644 --- a/conformance-report/src/ConformanceReport/IConformanceReportClientStore.cs +++ b/conformance-report/src/ConformanceReport/IConformanceReportClientStore.cs @@ -5,5 +5,5 @@ namespace Duende.ConformanceReport; internal interface IConformanceReportClientStore { - Task> GetAllClientsAsync(CT ct = default); + Task> GetAllClientsAsync(CT ct); } diff --git a/conformance-report/test/ConformanceReport.Tests/Endpoints/ConformanceEndpointTests.cs b/conformance-report/test/ConformanceReport.Tests/Endpoints/ConformanceEndpointTests.cs index 1b6aaf762..44eb2df11 100644 --- a/conformance-report/test/ConformanceReport.Tests/Endpoints/ConformanceEndpointTests.cs +++ b/conformance-report/test/ConformanceReport.Tests/Endpoints/ConformanceEndpointTests.cs @@ -99,7 +99,7 @@ public class ConformanceReportEndpointTests private sealed class InMemoryClientStore(IEnumerable clients) : IConformanceReportClientStore { - public Task> GetAllClientsAsync(CancellationToken ct = default) + public Task> GetAllClientsAsync(CancellationToken ct) => Task.FromResult(clients); } diff --git a/conformance-report/test/ConformanceReport.Tests/Services/ConformanceAssessmentServiceTests.cs b/conformance-report/test/ConformanceReport.Tests/Services/ConformanceAssessmentServiceTests.cs index be744dd56..8afd0f854 100644 --- a/conformance-report/test/ConformanceReport.Tests/Services/ConformanceAssessmentServiceTests.cs +++ b/conformance-report/test/ConformanceReport.Tests/Services/ConformanceAssessmentServiceTests.cs @@ -104,7 +104,7 @@ public class ConformanceAssessmentServiceTests private sealed class InMemoryClientStore(IEnumerable clients) : IConformanceReportClientStore { - public Task> GetAllClientsAsync(CancellationToken ct = default) => Task.FromResult(clients); + public Task> GetAllClientsAsync(CancellationToken ct) => Task.FromResult(clients); } private sealed class TestHttpContextAccessor : IHttpContextAccessor diff --git a/identity-server/hosts/EntityFramework10/TestOperationalStoreNotification.cs b/identity-server/hosts/EntityFramework10/TestOperationalStoreNotification.cs index 36e79cdd5..142fc3b05 100644 --- a/identity-server/hosts/EntityFramework10/TestOperationalStoreNotification.cs +++ b/identity-server/hosts/EntityFramework10/TestOperationalStoreNotification.cs @@ -12,7 +12,7 @@ public class TestOperationalStoreNotification : IOperationalStoreNotification { public TestOperationalStoreNotification() => Console.WriteLine("ctor"); - public Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct = default) + public Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct) { ArgumentNullException.ThrowIfNull(persistedGrants); foreach (var grant in persistedGrants) @@ -22,7 +22,7 @@ public class TestOperationalStoreNotification : IOperationalStoreNotification return Task.CompletedTask; } - public Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct = default) + public Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct) { ArgumentNullException.ThrowIfNull(deviceCodes); foreach (var deviceCode in deviceCodes) diff --git a/identity-server/hosts/UI/AspNetIdentity/Pages/Account/Login/Index.cshtml.cs b/identity-server/hosts/UI/AspNetIdentity/Pages/Account/Login/Index.cshtml.cs index 8cdf84436..99880c15a 100644 --- a/identity-server/hosts/UI/AspNetIdentity/Pages/Account/Login/Index.cshtml.cs +++ b/identity-server/hosts/UI/AspNetIdentity/Pages/Account/Login/Index.cshtml.cs @@ -50,7 +50,7 @@ public class Index : PageModel public async Task OnGet(string? returnUrl) { - await BuildModelAsync(returnUrl); + await BuildModelAsync(returnUrl, HttpContext.RequestAborted); if (View.IsExternalLoginOnly) { @@ -147,11 +147,11 @@ public class Index : PageModel } // something went wrong, show form with error - await BuildModelAsync(Input.ReturnUrl); + await BuildModelAsync(Input.ReturnUrl, HttpContext.RequestAborted); return Page(); } - private async Task BuildModelAsync(string? returnUrl) + private async Task BuildModelAsync(string? returnUrl, CT ct) { Input = new InputModel { @@ -193,7 +193,7 @@ public class Index : PageModel displayName: x.DisplayName ?? x.Name )).ToList(); - var dynamicSchemes = (await _identityProviderStore.GetAllSchemeNamesAsync()) + var dynamicSchemes = (await _identityProviderStore.GetAllSchemeNamesAsync(ct)) .Where(x => x.Enabled) .Select(x => new ViewModel.ExternalProvider ( diff --git a/identity-server/hosts/UI/Main/Pages/Account/Login/Index.cshtml.cs b/identity-server/hosts/UI/Main/Pages/Account/Login/Index.cshtml.cs index 6b79a843e..29bf3615a 100644 --- a/identity-server/hosts/UI/Main/Pages/Account/Login/Index.cshtml.cs +++ b/identity-server/hosts/UI/Main/Pages/Account/Login/Index.cshtml.cs @@ -46,7 +46,7 @@ public class Index : PageModel public async Task OnGet(string? returnUrl) { - await BuildModelAsync(returnUrl); + await BuildModelAsync(returnUrl, HttpContext.RequestAborted); if (View.IsExternalLoginOnly) { @@ -157,11 +157,11 @@ public class Index : PageModel } // something went wrong, show form with error - await BuildModelAsync(Input.ReturnUrl); + await BuildModelAsync(Input.ReturnUrl, HttpContext.RequestAborted); return Page(); } - private async Task BuildModelAsync(string? returnUrl) + private async Task BuildModelAsync(string? returnUrl, CT ct) { Input = new InputModel { @@ -203,7 +203,7 @@ public class Index : PageModel displayName: x.DisplayName ?? x.Name )).ToList(); - var dynamicSchemes = (await _identityProviderStore.GetAllSchemeNamesAsync()) + var dynamicSchemes = (await _identityProviderStore.GetAllSchemeNamesAsync(ct)) .Where(x => x.Enabled) .Select(x => new ViewModel.ExternalProvider ( diff --git a/identity-server/src/EntityFramework.Storage/Extensions/DbContextExtensions.cs b/identity-server/src/EntityFramework.Storage/Extensions/DbContextExtensions.cs index e88dceb6f..9728d56aa 100644 --- a/identity-server/src/EntityFramework.Storage/Extensions/DbContextExtensions.cs +++ b/identity-server/src/EntityFramework.Storage/Extensions/DbContextExtensions.cs @@ -18,7 +18,7 @@ public static class DbContextExtensions /// /// Saves changes and handles concurrency exceptions. /// - public static async Task> SaveChangesWithConcurrencyCheckAsync(this IPersistedGrantDbContext context, ILogger logger, CT ct = default) + public static async Task> SaveChangesWithConcurrencyCheckAsync(this IPersistedGrantDbContext context, ILogger logger, CT ct) where T : class { var list = new List(); diff --git a/identity-server/src/EntityFramework.Storage/Stores/IdentityProviderStore.cs b/identity-server/src/EntityFramework.Storage/Stores/IdentityProviderStore.cs index 76c8b7ba7..3bb47604d 100644 --- a/identity-server/src/EntityFramework.Storage/Stores/IdentityProviderStore.cs +++ b/identity-server/src/EntityFramework.Storage/Stores/IdentityProviderStore.cs @@ -48,7 +48,7 @@ public class IdentityProviderStore : IIdentityProviderStore } /// - public async Task> GetAllSchemeNamesAsync(CT ct = default) + public async Task> GetAllSchemeNamesAsync(CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("IdentityProviderStore.GetAllSchemeNames"); @@ -63,7 +63,7 @@ public class IdentityProviderStore : IIdentityProviderStore } /// - public async Task GetBySchemeAsync(string scheme, CT ct = default) + public async Task GetBySchemeAsync(string scheme, CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("IdentityProviderStore.GetByScheme"); activity?.SetTag(Tracing.Properties.Scheme, scheme); diff --git a/identity-server/src/EntityFramework.Storage/TokenCleanup/IOperationalStoreNotification.cs b/identity-server/src/EntityFramework.Storage/TokenCleanup/IOperationalStoreNotification.cs index c8489fe3a..9ac799a2a 100644 --- a/identity-server/src/EntityFramework.Storage/TokenCleanup/IOperationalStoreNotification.cs +++ b/identity-server/src/EntityFramework.Storage/TokenCleanup/IOperationalStoreNotification.cs @@ -19,13 +19,13 @@ public interface IOperationalStoreNotification /// /// /// - Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct = default); + Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct); /// /// Notification for device codes being removed. /// - /// - /// + /// The device codes being removed. + /// The cancellation token. /// - Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct = default); + Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct); } diff --git a/identity-server/src/EntityFramework.Storage/TokenCleanup/ITokenCleanupService.cs b/identity-server/src/EntityFramework.Storage/TokenCleanup/ITokenCleanupService.cs index 5b5fc8a6e..d56f7429f 100644 --- a/identity-server/src/EntityFramework.Storage/TokenCleanup/ITokenCleanupService.cs +++ b/identity-server/src/EntityFramework.Storage/TokenCleanup/ITokenCleanupService.cs @@ -19,5 +19,5 @@ public interface ITokenCleanupService /// A token that propagates notification /// that the cleanup operation should be canceled. /// - Task CleanupGrantsAsync(CT ct = default); + Task CleanupGrantsAsync(CT ct); } diff --git a/identity-server/src/EntityFramework.Storage/TokenCleanup/TokenCleanupService.cs b/identity-server/src/EntityFramework.Storage/TokenCleanup/TokenCleanupService.cs index 0a0e0d4dc..5a6aa2ec5 100644 --- a/identity-server/src/EntityFramework.Storage/TokenCleanup/TokenCleanupService.cs +++ b/identity-server/src/EntityFramework.Storage/TokenCleanup/TokenCleanupService.cs @@ -43,7 +43,7 @@ public class TokenCleanupService : ITokenCleanupService } /// - public async Task CleanupGrantsAsync(CT ct = default) + public async Task CleanupGrantsAsync(CT ct) { try { @@ -63,7 +63,7 @@ public class TokenCleanupService : ITokenCleanupService /// Removes the stale persisted grants. /// /// - protected virtual async Task RemoveGrantsAsync(CT ct = default) + protected virtual async Task RemoveGrantsAsync(CT ct) { await RemoveExpiredPersistedGrantsAsync(ct); if (_options.RemoveConsumedTokens) @@ -76,7 +76,7 @@ public class TokenCleanupService : ITokenCleanupService /// Removes the expired persisted grants. /// /// - protected virtual async Task RemoveExpiredPersistedGrantsAsync(CT ct = default) + protected virtual async Task RemoveExpiredPersistedGrantsAsync(CT ct) { var found = int.MaxValue; @@ -145,7 +145,7 @@ public class TokenCleanupService : ITokenCleanupService /// Removes the consumed persisted grants. /// /// - protected virtual async Task RemoveConsumedPersistedGrantsAsync(CT ct = default) + protected virtual async Task RemoveConsumedPersistedGrantsAsync(CT ct) { var found = int.MaxValue; @@ -208,7 +208,7 @@ public class TokenCleanupService : ITokenCleanupService /// Removes the stale device codes. /// /// - protected virtual async Task RemoveDeviceCodesAsync(CT ct = default) + protected virtual async Task RemoveDeviceCodesAsync(CT ct) { var found = int.MaxValue; @@ -264,7 +264,7 @@ public class TokenCleanupService : ITokenCleanupService /// /// Removes stale pushed authorization requests. /// - protected virtual async Task RemovePushedAuthorizationRequestsAsync(CT ct = default) + protected virtual async Task RemovePushedAuthorizationRequestsAsync(CT ct) { var found = int.MaxValue; diff --git a/identity-server/src/EntityFramework/TokenCleanupHost.cs b/identity-server/src/EntityFramework/TokenCleanupHost.cs index 60153bb24..7895f2c3c 100644 --- a/identity-server/src/EntityFramework/TokenCleanupHost.cs +++ b/identity-server/src/EntityFramework/TokenCleanupHost.cs @@ -121,7 +121,7 @@ public class TokenCleanupHost : IHostedService } } - private async Task RemoveExpiredGrantsAsync(CT ct = default) + private async Task RemoveExpiredGrantsAsync(CT ct) { try { diff --git a/identity-server/src/IdentityServer.ConformanceReport/IdentityServerClientStore.cs b/identity-server/src/IdentityServer.ConformanceReport/IdentityServerClientStore.cs index ea4f7d618..b29e71015 100644 --- a/identity-server/src/IdentityServer.ConformanceReport/IdentityServerClientStore.cs +++ b/identity-server/src/IdentityServer.ConformanceReport/IdentityServerClientStore.cs @@ -14,7 +14,7 @@ internal sealed class IdentityServerClientStore(IClientStore clientStore) : ICon #pragma warning restore CA1812 { public async Task> GetAllClientsAsync( - CancellationToken ct = default) + CancellationToken ct) { var clients = new List(); await foreach (var client in clientStore.GetAllClientsAsync(ct)) diff --git a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/InMemoryIdentityProviderStore.cs b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/InMemoryIdentityProviderStore.cs index 5ea5db929..8cb34904b 100644 --- a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/InMemoryIdentityProviderStore.cs +++ b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/InMemoryIdentityProviderStore.cs @@ -13,7 +13,7 @@ internal class InMemoryIdentityProviderStore : IIdentityProviderStore public InMemoryIdentityProviderStore(IEnumerable providers) => _providers = providers; - public Task> GetAllSchemeNamesAsync(CT ct = default) + public Task> GetAllSchemeNamesAsync(CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("InMemoryOidcProviderStore.GetAllSchemeNames"); @@ -27,7 +27,7 @@ internal class InMemoryIdentityProviderStore : IIdentityProviderStore return Task.FromResult(items); } - public Task GetBySchemeAsync(string scheme, CT ct = default) + public Task GetBySchemeAsync(string scheme, CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("InMemoryOidcProviderStore.GetByScheme"); diff --git a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NonCachingIdentityProviderStore.cs b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NonCachingIdentityProviderStore.cs index 894c9b9ef..e53db79cc 100644 --- a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NonCachingIdentityProviderStore.cs +++ b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NonCachingIdentityProviderStore.cs @@ -38,10 +38,10 @@ public class NonCachingIdentityProviderStore : IIdentityProviderStore } /// - public Task> GetAllSchemeNamesAsync(CT ct = default) => _inner.GetAllSchemeNamesAsync(ct); + public Task> GetAllSchemeNamesAsync(CT ct) => _inner.GetAllSchemeNamesAsync(ct); /// - public async Task GetBySchemeAsync(string scheme, CT ct = default) + public async Task GetBySchemeAsync(string scheme, CT ct) { if (_httpContextAccessor.HttpContext == null) { diff --git a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NopIdentityProviderStore.cs b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NopIdentityProviderStore.cs index 0a7d95659..c5d2dd833 100644 --- a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NopIdentityProviderStore.cs +++ b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/NopIdentityProviderStore.cs @@ -9,7 +9,7 @@ namespace Duende.IdentityServer.Hosting.DynamicProviders; internal class NopIdentityProviderStore : IIdentityProviderStore { - public Task> GetAllSchemeNamesAsync(CT ct = default) => Task.FromResult(Enumerable.Empty()); + public Task> GetAllSchemeNamesAsync(CT ct) => Task.FromResult(Enumerable.Empty()); - public Task GetBySchemeAsync(string scheme, CT ct = default) => Task.FromResult(null); + public Task GetBySchemeAsync(string scheme, CT ct) => Task.FromResult(null); } diff --git a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/ValidatingIdentityProviderStore.cs b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/ValidatingIdentityProviderStore.cs index 91587581d..a0a753f42 100644 --- a/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/ValidatingIdentityProviderStore.cs +++ b/identity-server/src/IdentityServer/Hosting/DynamicProviders/Store/ValidatingIdentityProviderStore.cs @@ -38,10 +38,10 @@ public class ValidatingIdentityProviderStore : IIdentityProviderStore } /// - public Task> GetAllSchemeNamesAsync(CT ct = default) => _inner.GetAllSchemeNamesAsync(ct); + public Task> GetAllSchemeNamesAsync(CT ct) => _inner.GetAllSchemeNamesAsync(ct); /// - public async Task GetBySchemeAsync(string scheme, CT ct = default) + public async Task GetBySchemeAsync(string scheme, CT ct) { var idp = await _inner.GetBySchemeAsync(scheme, ct); diff --git a/identity-server/src/IdentityServer/Hosting/ServerSideSessionCleanupHost.cs b/identity-server/src/IdentityServer/Hosting/ServerSideSessionCleanupHost.cs index e3d1dcfd7..07c33ed3b 100644 --- a/identity-server/src/IdentityServer/Hosting/ServerSideSessionCleanupHost.cs +++ b/identity-server/src/IdentityServer/Hosting/ServerSideSessionCleanupHost.cs @@ -68,7 +68,7 @@ public class ServerSideSessionCleanupHost( logger.LogDebug("Stopping server-side session removal"); } - private async Task RunAsync(CT ct = default) + private async Task RunAsync(CT ct) { // this is here for testing if (!options.ServerSideSessions.RemoveExpiredSessions) diff --git a/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticHostedService.cs b/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticHostedService.cs index b68745268..8e0f583f5 100644 --- a/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticHostedService.cs +++ b/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticHostedService.cs @@ -19,7 +19,7 @@ internal class DiagnosticHostedService(DiagnosticSummary diagnosticSummary, IOpt { try { - await diagnosticSummary.PrintSummary(); + await diagnosticSummary.PrintSummary(stoppingToken); } catch (Exception ex) { @@ -39,7 +39,7 @@ internal class DiagnosticHostedService(DiagnosticSummary diagnosticSummary, IOpt public override async Task StopAsync(CT ct) { - await diagnosticSummary.PrintSummary(); + await diagnosticSummary.PrintSummary(ct); await base.StopAsync(ct); } diff --git a/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticSummary.cs b/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticSummary.cs index c30e7fc78..f0240508e 100644 --- a/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticSummary.cs +++ b/identity-server/src/IdentityServer/Licensing/V2/Diagnostics/DiagnosticSummary.cs @@ -12,9 +12,9 @@ internal class DiagnosticSummary(DiagnosticDataService diagnosticDataService, Id { private readonly ILogger _logger = loggerFactory.CreateLogger("Duende.IdentityServer.Diagnostics.Summary"); - public async Task PrintSummary() + public async Task PrintSummary(CT ct) { - var jsonMemory = await diagnosticDataService.GetJsonBytesAsync(); + var jsonMemory = await diagnosticDataService.GetJsonBytesAsync(ct); var span = jsonMemory.Span; using var diagnosticActivity = Tracing.DiagnosticsActivitySource.StartActivity("DiagnosticSummary"); diff --git a/identity-server/src/IdentityServer/Services/Default/KeyManagement/KeyManager.cs b/identity-server/src/IdentityServer/Services/Default/KeyManagement/KeyManager.cs index 6c3ba037f..1697f2d2e 100644 --- a/identity-server/src/IdentityServer/Services/Default/KeyManagement/KeyManager.cs +++ b/identity-server/src/IdentityServer/Services/Default/KeyManagement/KeyManager.cs @@ -95,7 +95,7 @@ public class KeyManager : IKeyManager - internal async Task<(IEnumerable allKeys, IEnumerable signingKeys)> GetAllKeysInternalAsync(CT ct = default) + internal async Task<(IEnumerable allKeys, IEnumerable signingKeys)> GetAllKeysInternalAsync(CT ct) { var cached = true; var keys = await GetAllKeysFromCacheAsync(ct); @@ -265,7 +265,7 @@ public class KeyManager : IKeyManager return false; } - internal async Task CreateAndStoreNewKeyAsync(SigningAlgorithmOptions alg, CT ct = default) + internal async Task CreateAndStoreNewKeyAsync(SigningAlgorithmOptions alg, CT ct) { _logger.LogTrace("Creating new key."); @@ -307,7 +307,7 @@ public class KeyManager : IKeyManager return container; } - internal async Task> GetAllKeysFromCacheAsync(CT ct = default) + internal async Task> GetAllKeysFromCacheAsync(CT ct) { var cachedKeys = await _cache.GetKeysAsync(ct); if (cachedKeys != null) @@ -340,7 +340,7 @@ public class KeyManager : IKeyManager return result; } - internal async Task> FilterAndDeleteRetiredKeysAsync(IEnumerable keys, CT ct = default) + internal async Task> FilterAndDeleteRetiredKeysAsync(IEnumerable keys, CT ct) { var retired = keys .Where(x => @@ -373,7 +373,7 @@ public class KeyManager : IKeyManager return result; } - internal async Task DeleteKeysAsync(IEnumerable keys, CT ct = default) + internal async Task DeleteKeysAsync(IEnumerable keys, CT ct) { if (keys == null || !keys.Any()) { @@ -399,7 +399,7 @@ public class KeyManager : IKeyManager return result; } - internal async Task CacheKeysAsync(IEnumerable keys, CT ct = default) + internal async Task CacheKeysAsync(IEnumerable keys, CT ct) { if (keys?.Any() == true) { @@ -505,7 +505,7 @@ public class KeyManager : IKeyManager - internal async Task<(IEnumerable allKeys, IEnumerable activeKeys)> CreateNewKeysAndAddToCacheAsync(CT ct = default) + internal async Task<(IEnumerable allKeys, IEnumerable activeKeys)> CreateNewKeysAndAddToCacheAsync(CT ct) { var keys = new List(); keys.AddRange(await _cache.GetKeysAsync(ct) ?? Enumerable.Empty()); diff --git a/identity-server/src/IdentityServer/Services/DiagnosticDataService.cs b/identity-server/src/IdentityServer/Services/DiagnosticDataService.cs index 590e4725f..5e0b3837f 100644 --- a/identity-server/src/IdentityServer/Services/DiagnosticDataService.cs +++ b/identity-server/src/IdentityServer/Services/DiagnosticDataService.cs @@ -22,7 +22,7 @@ public class DiagnosticDataService _entries = entries; } - public async Task> GetJsonBytesAsync(CT ct = default) + public async Task> GetJsonBytesAsync(CT ct) { var bufferWriter = new ArrayBufferWriter(); await using var writer = new Utf8JsonWriter(bufferWriter, new JsonWriterOptions { Indented = false }); @@ -42,7 +42,7 @@ public class DiagnosticDataService return bufferWriter.WrittenMemory; } - public async Task GetJsonStringAsync(CT ct = default) + public async Task GetJsonStringAsync(CT ct) { var bytes = await GetJsonBytesAsync(ct); return Encoding.UTF8.GetString(bytes.Span); diff --git a/identity-server/src/IdentityServer/Stores/Default/ServerSideTicketStore.cs b/identity-server/src/IdentityServer/Stores/Default/ServerSideTicketStore.cs index 97e712ec5..c5675c3b3 100644 --- a/identity-server/src/IdentityServer/Stores/Default/ServerSideTicketStore.cs +++ b/identity-server/src/IdentityServer/Stores/Default/ServerSideTicketStore.cs @@ -185,7 +185,7 @@ public class ServerSideTicketStore : IServerSideTicketStore } /// - public async Task> GetSessionsAsync(SessionFilter filter, CT ct = default) + public async Task> GetSessionsAsync(SessionFilter filter, CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("ServerSideTicketStore.GetSessions"); @@ -196,7 +196,7 @@ public class ServerSideTicketStore : IServerSideTicketStore } /// - public async Task> QuerySessionsAsync(SessionQuery filter = null, CT ct = default) + public async Task> QuerySessionsAsync(SessionQuery filter, CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("ServerSideTicketStore.QuerySessions"); @@ -219,7 +219,7 @@ public class ServerSideTicketStore : IServerSideTicketStore } /// - public async Task> GetAndRemoveExpiredSessionsAsync(int count, CT ct = default) + public async Task> GetAndRemoveExpiredSessionsAsync(int count, CT ct) { using var activity = Tracing.StoreActivitySource.StartActivity("ServerSideTicketStore.GetAndRemoveExpiredSessions"); diff --git a/identity-server/src/IdentityServer/Stores/IServerSideTicketStore.cs b/identity-server/src/IdentityServer/Stores/IServerSideTicketStore.cs index dc5b1982f..7c4ca04e3 100644 --- a/identity-server/src/IdentityServer/Stores/IServerSideTicketStore.cs +++ b/identity-server/src/IdentityServer/Stores/IServerSideTicketStore.cs @@ -17,15 +17,21 @@ public interface IServerSideTicketStore : ITicketStore /// /// Gets sessions for a specific subject id and/or session id /// - Task> GetSessionsAsync(SessionFilter filter, CT ct = default); + /// The session filter. + /// The cancellation token. + Task> GetSessionsAsync(SessionFilter filter, CT ct); /// /// Queries user sessions based on filter /// - Task> QuerySessionsAsync(SessionQuery filter, CT ct = default); + /// The session query filter. + /// The cancellation token. + Task> QuerySessionsAsync(SessionQuery filter, CT ct); /// /// Removes and returns expired sessions /// - Task> GetAndRemoveExpiredSessionsAsync(int count, CT ct = default); + /// The maximum number of sessions to return. + /// The cancellation token. + Task> GetAndRemoveExpiredSessionsAsync(int count, CT ct); } diff --git a/identity-server/src/Storage/Stores/IIdentityProviderStore.cs b/identity-server/src/Storage/Stores/IIdentityProviderStore.cs index a233528c8..f57c58f05 100644 --- a/identity-server/src/Storage/Stores/IIdentityProviderStore.cs +++ b/identity-server/src/Storage/Stores/IIdentityProviderStore.cs @@ -16,14 +16,14 @@ public interface IIdentityProviderStore /// /// Gets all identity providers name. /// - /// - Task> GetAllSchemeNamesAsync(CT ct = default); + /// The cancellation token. + Task> GetAllSchemeNamesAsync(CT ct); /// /// Gets the identity provider by scheme name. /// - /// - /// + /// The scheme name. + /// The cancellation token. /// - Task GetBySchemeAsync(string scheme, CT ct = default); + Task GetBySchemeAsync(string scheme, CT ct); } diff --git a/identity-server/test/IdentityServer.IntegrationTests/Configuration/DynamicClientRegistrationTests.cs b/identity-server/test/IdentityServer.IntegrationTests/Configuration/DynamicClientRegistrationTests.cs index 54995bd0f..16bf4eba0 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/Configuration/DynamicClientRegistrationTests.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/Configuration/DynamicClientRegistrationTests.cs @@ -11,6 +11,7 @@ namespace Duende.IdentityServer.IntegrationTests.Configuration; public class DynamicClientRegistrationTests : ConfigurationIntegrationTestBase { + private readonly CT _ct = TestContext.Current.CancellationToken; [Fact] public async Task valid_request_creates_new_client() { @@ -29,7 +30,7 @@ public class DynamicClientRegistrationTests : ConfigurationIntegrationTestBase var response = await httpResponse.Content.ReadFromJsonAsync(); response.ShouldNotBeNull(); - var newClient = await IdentityServerHost.GetClientAsync(response!.ClientId); // Not null already asserted + var newClient = await IdentityServerHost.GetClientAsync(response!.ClientId, _ct); // Not null already asserted newClient.ShouldNotBeNull(); newClient.ClientId.ShouldBe(response.ClientId); newClient.AllowedGrantTypes.ShouldBe(request.GrantTypes); diff --git a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/MockOperationalStoreNotification.cs b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/MockOperationalStoreNotification.cs index b9bd35bd3..68a114666 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/MockOperationalStoreNotification.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/MockOperationalStoreNotification.cs @@ -15,14 +15,14 @@ public class MockOperationalStoreNotification : IOperationalStoreNotification public Action> OnPersistedGrantsRemoved = _ => { }; public Action> OnDeviceFlowCodesRemoved = _ => { }; - public Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct = default) + public Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants, CT ct) { OnPersistedGrantsRemoved(persistedGrants); PersistedGrantNotifications.Add(persistedGrants); return Task.CompletedTask; } - public Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct = default) + public Task DeviceCodesRemovedAsync(IEnumerable deviceCodes, CT ct) { OnDeviceFlowCodesRemoved(deviceCodes); DeviceFlowCodeNotifications.Append(deviceCodes); diff --git a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/Stores/IdentityProviderStoreTests.cs b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/Stores/IdentityProviderStoreTests.cs index 2b8aaaa64..e3a0bf3c3 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/Stores/IdentityProviderStoreTests.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/Stores/IdentityProviderStoreTests.cs @@ -15,6 +15,8 @@ namespace Duende.IdentityServer.IntegrationTests.EntityFramework.Storage.Stores; public class IdentityProviderStoreTests : IntegrationTest { + private readonly CT _ct = TestContext.Current.CancellationToken; + public IdentityProviderStoreTests(DatabaseProviderFixture fixture) : base(fixture) { foreach (var options in TestDatabaseProviders) @@ -43,7 +45,7 @@ public class IdentityProviderStoreTests : IntegrationTest(), new NoneCancellationTokenProvider()); - var item = await store.GetBySchemeAsync("scheme1"); + var item = await store.GetBySchemeAsync("scheme1", _ct); item.ShouldNotBeNull(); } @@ -67,7 +69,7 @@ public class IdentityProviderStoreTests : IntegrationTest(), new NoneCancellationTokenProvider()); - var item = await store.GetBySchemeAsync("scheme2"); + var item = await store.GetBySchemeAsync("scheme2", _ct); item.ShouldBeNull(); } @@ -90,7 +92,7 @@ public class IdentityProviderStoreTests : IntegrationTest(), new NoneCancellationTokenProvider()); - var item = await store.GetBySchemeAsync("scheme3"); + var item = await store.GetBySchemeAsync("scheme3", _ct); item.ShouldBeNull(); } diff --git a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/TokenCleanup/TokenCleanupTests.cs b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/TokenCleanup/TokenCleanupTests.cs index 1f63ac5cd..319d776a8 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/TokenCleanup/TokenCleanupTests.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/EntityFramework/Storage/TokenCleanup/TokenCleanupTests.cs @@ -18,6 +18,7 @@ namespace Duende.IdentityServer.IntegrationTests.EntityFramework.Storage.TokenCl public class TokenCleanupTests : IntegrationTest { + private readonly CT _ct = TestContext.Current.CancellationToken; public TokenCleanupTests(DatabaseProviderFixture fixture) : base(fixture) { foreach (var options in TestDatabaseProviders) @@ -57,7 +58,7 @@ public class TokenCleanupTests : IntegrationTest { svcs.AddSingleton(mockNotifications); - }).CleanupGrantsAsync(); + }).CleanupGrantsAsync(_ct); // The right number of batches executed mockNotifications.PersistedGrantNotifications.Count.ShouldBe(expectedPageCount); @@ -356,7 +357,7 @@ public class TokenCleanupTests : IntegrationTest { svcs.AddSingleton(mockNotifications); - }).CleanupGrantsAsync(); + }).CleanupGrantsAsync(_ct); // Each batch created an extra grant, so we do an extra batch to clean up // the extras @@ -417,7 +418,7 @@ public class TokenCleanupTests : IntegrationTest x.SessionId).ShouldBe(sessions.Select(x => x.SessionId)); diff --git a/identity-server/test/IdentityServer.IntegrationTests/TestHosts/IdentityServerHost.cs b/identity-server/test/IdentityServer.IntegrationTests/TestHosts/IdentityServerHost.cs index d71bbea2b..ee536963f 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/TestHosts/IdentityServerHost.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/TestHosts/IdentityServerHost.cs @@ -60,7 +60,7 @@ public class IdentityServerHost : GenericHost } - public async Task GetClientAsync(string clientId, CT ct = default) + public async Task GetClientAsync(string clientId, CT ct) { var store = Resolve(); return await store.FindClientByIdAsync(clientId, ct); diff --git a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/DiagnosticSummaryTests.cs b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/DiagnosticSummaryTests.cs index eaf48b94b..81ce35be3 100644 --- a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/DiagnosticSummaryTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/DiagnosticSummaryTests.cs @@ -13,6 +13,8 @@ namespace IdentityServer.UnitTests.Licensing.V2; public class DiagnosticSummaryTests { + private readonly CT _ct = TestContext.Current.CancellationToken; + [Fact] public async Task PrintSummary_ShouldCallWriteAsyncOnEveryDiagnosticEntry() { @@ -29,7 +31,7 @@ public class DiagnosticSummaryTests var diagnosticService = new DiagnosticDataService(DateTime.UtcNow, entries); var summary = new DiagnosticSummary(diagnosticService, new IdentityServerOptions(), new StubLoggerFactory(logger)); - await summary.PrintSummary(); + await summary.PrintSummary(_ct); firstDiagnosticEntry.WasCalled.ShouldBeTrue(); secondDiagnosticEntry.WasCalled.ShouldBeTrue(); @@ -47,7 +49,7 @@ public class DiagnosticSummaryTests var diagnosticService = new DiagnosticDataService(DateTime.UtcNow, [diagnosticEntry]); var summary = new DiagnosticSummary(diagnosticService, options, new StubLoggerFactory(logger)); - await summary.PrintSummary(); + await summary.PrintSummary(_ct); var logSnapshot = logger.Collector.GetSnapshot().Select(x => x.Message); logSnapshot.ShouldBe([ @@ -68,7 +70,7 @@ public class DiagnosticSummaryTests var summary = new DiagnosticSummary(diagnosticService, options, new StubLoggerFactory(logger)); - await summary.PrintSummary(); + await summary.PrintSummary(_ct); var logSnapshot = logger.Collector.GetSnapshot().Select(x => x.Message); logSnapshot.ShouldBe(["Diagnostic data (1 of 3): {\"test\":", "Diagnostic data (2 of 3): \"\\u20AC\\", "Diagnostic data (3 of 3): u20AC\"}"]); @@ -85,7 +87,7 @@ public class DiagnosticSummaryTests var summary = new DiagnosticSummary(diagnosticService, options, new StubLoggerFactory(logger)); - await summary.PrintSummary(); + await summary.PrintSummary(_ct); foreach (var entry in logger.Collector.GetSnapshot()) { entry.Message.Length.ShouldBeLessThanOrEqualTo(1024 * 8); @@ -101,7 +103,7 @@ public class DiagnosticSummaryTests var diagnosticService = new DiagnosticDataService(DateTime.UtcNow, [diagnosticEntry]); var summary = new DiagnosticSummary(diagnosticService, options, new StubLoggerFactory(logger)); - await summary.PrintSummary(); + await summary.PrintSummary(_ct); var logSnapshot = logger.Collector.GetSnapshot(); logSnapshot.Count.ShouldBeGreaterThan(0); diff --git a/identity-server/test/IdentityServer.UnitTests/Services/Default/DefaultPersistedGrantServiceTests.cs b/identity-server/test/IdentityServer.UnitTests/Services/Default/DefaultPersistedGrantServiceTests.cs index 29e25aeae..08c394847 100644 --- a/identity-server/test/IdentityServer.UnitTests/Services/Default/DefaultPersistedGrantServiceTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Services/Default/DefaultPersistedGrantServiceTests.cs @@ -314,7 +314,7 @@ public class DefaultPersistedGrantServiceTests RequestedScopes = new string[] { "quux3" } }, _ct); - await _subject.RemoveAllGrantsAsync("123", "client1"); + await _subject.RemoveAllGrantsAsync("123", "client1", ct: _ct); (await _referenceTokens.GetReferenceTokenAsync(handle1, _ct)).ShouldBeNull(); (await _referenceTokens.GetReferenceTokenAsync(handle2, _ct)).ShouldNotBeNull(); @@ -358,7 +358,7 @@ public class DefaultPersistedGrantServiceTests Lifetime = 10, }, _ct); - await _subject.RemoveAllGrantsAsync("123"); + await _subject.RemoveAllGrantsAsync("123", ct: _ct); (await _refreshTokens.GetRefreshTokenAsync(handle1, _ct)).ShouldBeNull(); (await _refreshTokens.GetRefreshTokenAsync(handle2, _ct)).ShouldBeNull(); @@ -396,7 +396,7 @@ public class DefaultPersistedGrantServiceTests Lifetime = 10, }, _ct); - await _subject.RemoveAllGrantsAsync("123", "client1"); + await _subject.RemoveAllGrantsAsync("123", "client1", ct: _ct); (await _refreshTokens.GetRefreshTokenAsync(handle1, _ct)).ShouldBeNull(); (await _refreshTokens.GetRefreshTokenAsync(handle2, _ct)).ShouldNotBeNull(); @@ -442,7 +442,7 @@ public class DefaultPersistedGrantServiceTests CreationTime = DateTime.UtcNow, Lifetime = 10, }, _ct); - await _subject.RemoveAllGrantsAsync("123", "client1", "session1"); + await _subject.RemoveAllGrantsAsync("123", "client1", "session1", _ct); (await _refreshTokens.GetRefreshTokenAsync(handle1, _ct)).ShouldBeNull(); (await _refreshTokens.GetRefreshTokenAsync(handle2, _ct)).ShouldNotBeNull(); @@ -490,7 +490,7 @@ public class DefaultPersistedGrantServiceTests CreationTime = DateTime.UtcNow, Lifetime = 10, }, _ct); - await _subject.RemoveAllGrantsAsync("123", sessionId: "session1"); + await _subject.RemoveAllGrantsAsync("123", sessionId: "session1", ct: _ct); (await _refreshTokens.GetRefreshTokenAsync(handle1, _ct)).ShouldBeNull(); (await _refreshTokens.GetRefreshTokenAsync(handle2, _ct)).ShouldBeNull(); diff --git a/identity-server/test/IdentityServer.UnitTests/Services/Default/KeyManagement/KeyManagerTests.cs b/identity-server/test/IdentityServer.UnitTests/Services/Default/KeyManagement/KeyManagerTests.cs index 3c654e8f1..a2e159860 100644 --- a/identity-server/test/IdentityServer.UnitTests/Services/Default/KeyManagement/KeyManagerTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Services/Default/KeyManagement/KeyManagerTests.cs @@ -354,7 +354,7 @@ public class KeyManagerTests { var id = CreateCacheAndStoreKey(); - var keys = await _subject.GetAllKeysFromCacheAsync(); + var keys = await _subject.GetAllKeysFromCacheAsync(_ct); keys.Count().ShouldBe(1); keys.Single().Id.ShouldBe(id); @@ -543,13 +543,13 @@ public class KeyManagerTests public async Task CacheKeysAsync_should_not_store_empty_keys() { { - await _subject.CacheKeysAsync(null); + await _subject.CacheKeysAsync(null, _ct); _mockKeyStoreCache.StoreKeysAsyncWasCalled.ShouldBeFalse(); } { - await _subject.CacheKeysAsync(new RsaKeyContainer[0]); + await _subject.CacheKeysAsync(new RsaKeyContainer[0], _ct); _mockKeyStoreCache.StoreKeysAsyncWasCalled.ShouldBeFalse(); } @@ -561,7 +561,7 @@ public class KeyManagerTests var key1 = CreateKey(_options.KeyManagement.PropagationTime.Add(TimeSpan.FromMinutes(5))); var key2 = CreateKey(_options.KeyManagement.PropagationTime.Add(TimeSpan.FromMinutes(10))); - await _subject.CacheKeysAsync(new[] { key1, key2 }); + await _subject.CacheKeysAsync(new[] { key1, key2 }, _ct); _mockKeyStoreCache.StoreKeysAsyncWasCalled.ShouldBeTrue(); _mockKeyStoreCache.StoreKeysAsyncDuration.ShouldBe(_options.KeyManagement.KeyCacheDuration); @@ -574,7 +574,7 @@ public class KeyManagerTests { var key1 = CreateKey(); - await _subject.CacheKeysAsync(new[] { key1 }); + await _subject.CacheKeysAsync(new[] { key1 }, _ct); _mockKeyStoreCache.StoreKeysAsyncWasCalled.ShouldBeTrue(); _mockKeyStoreCache.StoreKeysAsyncDuration.ShouldBe(_options.KeyManagement.InitializationKeyCacheDuration); diff --git a/identity-server/test/IdentityServer.UnitTests/Services/DiagnosticDataServiceTests.cs b/identity-server/test/IdentityServer.UnitTests/Services/DiagnosticDataServiceTests.cs index ef4178da0..9598893c1 100644 --- a/identity-server/test/IdentityServer.UnitTests/Services/DiagnosticDataServiceTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Services/DiagnosticDataServiceTests.cs @@ -10,6 +10,8 @@ namespace IdentityServer.UnitTests.Services; public class DiagnosticDataServiceTests { + private readonly CT _ct = TestContext.Current.CancellationToken; + [Fact] public async Task GetJsonBytesAsync_WithNoEntries_ShouldReturnEmptyJsonObject() { @@ -17,7 +19,7 @@ public class DiagnosticDataServiceTests var entries = new List(); var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); json.ShouldBe("{}"); @@ -33,7 +35,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); var jsonDoc = JsonDocument.Parse(json); @@ -52,7 +54,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); var jsonDoc = JsonDocument.Parse(json); @@ -72,7 +74,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - await service.GetJsonBytesAsync(); + await service.GetJsonBytesAsync(_ct); capturedContext.Context.ShouldNotBeNull(); capturedContext.Context.ServerStartTime.ShouldBe(serverStartTime); @@ -90,7 +92,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); json.ShouldNotContain("\n"); @@ -105,7 +107,7 @@ public class DiagnosticDataServiceTests var entries = new List(); var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonStringAsync(); + var result = await service.GetJsonStringAsync(_ct); result.ShouldBe("{}"); } @@ -120,7 +122,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonStringAsync(); + var result = await service.GetJsonStringAsync(_ct); var jsonDoc = JsonDocument.Parse(result); jsonDoc.RootElement.GetProperty("TestProperty").GetString().ShouldBe("TestValue"); @@ -138,7 +140,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonStringAsync(); + var result = await service.GetJsonStringAsync(_ct); var jsonDoc = JsonDocument.Parse(result); jsonDoc.RootElement.GetProperty("Property1").GetString().ShouldBe("Value1"); @@ -156,7 +158,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonStringAsync(); + var result = await service.GetJsonStringAsync(_ct); var jsonDoc = JsonDocument.Parse(result); jsonDoc.RootElement.GetProperty("Property").GetString().ShouldBe("Value with émojis 🎉"); @@ -173,8 +175,8 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var stringResult = await service.GetJsonStringAsync(); - var bytesResult = await service.GetJsonBytesAsync(); + var stringResult = await service.GetJsonStringAsync(_ct); + var bytesResult = await service.GetJsonBytesAsync(_ct); var stringFromBytes = Encoding.UTF8.GetString(bytesResult.Span); stringResult.ShouldBe(stringFromBytes); @@ -190,7 +192,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); var jsonDoc = JsonDocument.Parse(json); @@ -210,7 +212,7 @@ public class DiagnosticDataServiceTests }; var service = new DiagnosticDataService(serverStartTime, entries); - var result = await service.GetJsonBytesAsync(); + var result = await service.GetJsonBytesAsync(_ct); var json = Encoding.UTF8.GetString(result.Span); var jsonDoc = JsonDocument.Parse(json);