mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Remove ICancellationTokenProvider — flow CT directly through method parameters
This commit is contained in:
parent
01e958c57f
commit
32dc311eb7
30 changed files with 70 additions and 270 deletions
|
|
@ -5,7 +5,6 @@
|
|||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Duende.IdentityServer.Configuration;
|
||||
|
|
@ -21,11 +20,6 @@ public class ClientConfigurationStore : IClientConfigurationStore
|
|||
/// </summary>
|
||||
protected readonly IConfigurationDbContext DbContext;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -37,11 +31,9 @@ public class ClientConfigurationStore : IClientConfigurationStore
|
|||
/// </summary>
|
||||
public ClientConfigurationStore(
|
||||
IConfigurationDbContext dbContext,
|
||||
ICancellationTokenProvider cancellationTokenProvider,
|
||||
ILogger<ClientConfigurationStore> logger)
|
||||
{
|
||||
DbContext = dbContext;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Duende.IdentityServer.Configuration.EntityFramework;
|
||||
|
||||
/// <summary>
|
||||
/// Provides cancellation tokens based on the incoming http request
|
||||
/// </summary>
|
||||
#pragma warning disable CA1812 // This class is not instantiated directly, but rather used by the DI container
|
||||
internal sealed class DefaultCancellationTokenProvider : ICancellationTokenProvider
|
||||
#pragma warning restore CA1812
|
||||
{
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="httpContextAccessor"></param>
|
||||
public DefaultCancellationTokenProvider(IHttpContextAccessor httpContextAccessor) => _httpContextAccessor = httpContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to the cancellation token from the http context
|
||||
/// </summary>
|
||||
public CancellationToken CancellationToken => _httpContextAccessor.HttpContext?.RequestAborted ?? CancellationToken.None;
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
|
@ -22,7 +21,6 @@ public static class ServiceCollectionExtensions
|
|||
/// </summary>
|
||||
public static IServiceCollection AddClientConfigurationStore(this IdentityServerConfigurationBuilder builder)
|
||||
{
|
||||
builder.Services.TryAddTransient<ICancellationTokenProvider, DefaultCancellationTokenProvider>();
|
||||
builder.Services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
return builder.Services.AddTransient<IClientConfigurationStore, ClientConfigurationStore>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -23,11 +22,6 @@ public class ClientStore : IClientStore
|
|||
/// </summary>
|
||||
protected readonly IConfigurationDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -38,13 +32,11 @@ public class ClientStore : IClientStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public ClientStore(IConfigurationDbContext context, ILogger<ClientStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public ClientStore(IConfigurationDbContext context, ILogger<ClientStore> logger)
|
||||
{
|
||||
Context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Duende.IdentityModel;
|
|||
using Duende.IdentityServer.EntityFramework.Entities;
|
||||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Duende.IdentityServer.Stores.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -30,11 +29,6 @@ public class DeviceFlowStore : IDeviceFlowStore
|
|||
/// </summary>
|
||||
protected readonly IPersistentGrantSerializer Serializer;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -46,17 +40,14 @@ public class DeviceFlowStore : IDeviceFlowStore
|
|||
/// <param name="context">The context.</param>
|
||||
/// <param name="serializer">The serializer</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
public DeviceFlowStore(
|
||||
IPersistedGrantDbContext context,
|
||||
IPersistentGrantSerializer serializer,
|
||||
ILogger<DeviceFlowStore> logger,
|
||||
ICancellationTokenProvider cancellationTokenProvider)
|
||||
ILogger<DeviceFlowStore> logger)
|
||||
{
|
||||
Context = context;
|
||||
Serializer = serializer;
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -23,11 +22,6 @@ public class IdentityProviderStore : IIdentityProviderStore
|
|||
/// </summary>
|
||||
protected readonly IConfigurationDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -38,13 +32,11 @@ public class IdentityProviderStore : IIdentityProviderStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public IdentityProviderStore(IConfigurationDbContext context, ILogger<IdentityProviderStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public IdentityProviderStore(IConfigurationDbContext context, ILogger<IdentityProviderStore> logger)
|
||||
{
|
||||
Context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Duende.IdentityServer.EntityFramework.Entities;
|
|||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Extensions;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -24,11 +23,6 @@ public class PersistedGrantStore : Duende.IdentityServer.Stores.IPersistedGrantS
|
|||
/// </summary>
|
||||
protected readonly IPersistedGrantDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken service.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -39,12 +33,10 @@ public class PersistedGrantStore : Duende.IdentityServer.Stores.IPersistedGrantS
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
public PersistedGrantStore(IPersistedGrantDbContext context, ILogger<PersistedGrantStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public PersistedGrantStore(IPersistedGrantDbContext context, ILogger<PersistedGrantStore> logger)
|
||||
{
|
||||
Context = context;
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -19,11 +18,6 @@ public class PushedAuthorizationRequestStore : IPushedAuthorizationRequestStore
|
|||
/// </summary>
|
||||
protected readonly IPersistedGrantDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken service.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -34,12 +28,10 @@ public class PushedAuthorizationRequestStore : IPushedAuthorizationRequestStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
public PushedAuthorizationRequestStore(IPersistedGrantDbContext context, ILogger<PushedAuthorizationRequestStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public PushedAuthorizationRequestStore(IPersistedGrantDbContext context, ILogger<PushedAuthorizationRequestStore> logger)
|
||||
{
|
||||
Context = context;
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
|
|
@ -6,7 +6,6 @@ using Duende.IdentityServer.EntityFramework.Interfaces;
|
|||
using Duende.IdentityServer.EntityFramework.Mappers;
|
||||
using Duende.IdentityServer.Extensions;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -24,11 +23,6 @@ public class ResourceStore : IResourceStore
|
|||
/// </summary>
|
||||
protected readonly IConfigurationDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -39,13 +33,11 @@ public class ResourceStore : IResourceStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public ResourceStore(IConfigurationDbContext context, ILogger<ResourceStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public ResourceStore(IConfigurationDbContext context, ILogger<ResourceStore> logger)
|
||||
{
|
||||
Context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
using Duende.IdentityServer.EntityFramework.Extensions;
|
||||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -23,11 +22,6 @@ public class ServerSideSessionStore : IServerSideSessionStore
|
|||
/// </summary>
|
||||
protected readonly IPersistedGrantDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -38,13 +32,11 @@ public class ServerSideSessionStore : IServerSideSessionStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public ServerSideSessionStore(IPersistedGrantDbContext context, ILogger<ServerSideSessionStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public ServerSideSessionStore(IPersistedGrantDbContext context, ILogger<ServerSideSessionStore> logger)
|
||||
{
|
||||
Context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Duende.IdentityServer.EntityFramework.Entities;
|
||||
using Duende.IdentityServer.EntityFramework.Interfaces;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -25,11 +24,6 @@ public class SigningKeyStore : ISigningKeyStore
|
|||
/// </summary>
|
||||
protected readonly IPersistedGrantDbContext Context;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -40,13 +34,11 @@ public class SigningKeyStore : ISigningKeyStore
|
|||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public SigningKeyStore(IPersistedGrantDbContext context, ILogger<SigningKeyStore> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public SigningKeyStore(IPersistedGrantDbContext context, ILogger<SigningKeyStore> logger)
|
||||
{
|
||||
Context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -20,11 +20,6 @@ public class CorsPolicyService : ICorsPolicyService
|
|||
/// </summary>
|
||||
protected readonly IConfigurationDbContext DbContext;
|
||||
|
||||
/// <summary>
|
||||
/// The CancellationToken provider.
|
||||
/// </summary>
|
||||
protected readonly ICancellationTokenProvider CancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
|
|
@ -36,13 +31,11 @@ public class CorsPolicyService : ICorsPolicyService
|
|||
/// </summary>
|
||||
/// <param name="dbContext">The DbContext</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
/// <exception cref="ArgumentNullException">context</exception>
|
||||
public CorsPolicyService(IConfigurationDbContext dbContext, ILogger<CorsPolicyService> logger, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public CorsPolicyService(IConfigurationDbContext dbContext, ILogger<CorsPolicyService> logger)
|
||||
{
|
||||
DbContext = dbContext;
|
||||
Logger = logger;
|
||||
CancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ public static class IdentityServerBuilderExtensionsAdditional
|
|||
var httpClient = httpClientFactory.CreateClient(name);
|
||||
var loggerFactory = s.GetRequiredService<ILoggerFactory>();
|
||||
|
||||
return new DefaultBackChannelLogoutHttpClient(httpClient, loggerFactory, new NoneCancellationTokenProvider());
|
||||
return new DefaultBackChannelLogoutHttpClient(httpClient, loggerFactory);
|
||||
});
|
||||
|
||||
return httpBuilder;
|
||||
|
|
@ -491,7 +491,7 @@ public static class IdentityServerBuilderExtensionsAdditional
|
|||
var loggerFactory = s.GetRequiredService<ILoggerFactory>();
|
||||
var options = s.GetRequiredService<IdentityServerOptions>();
|
||||
|
||||
return new DefaultJwtRequestUriHttpClient(httpClient, options, loggerFactory, new NoneCancellationTokenProvider());
|
||||
return new DefaultJwtRequestUriHttpClient(httpClient, options, loggerFactory);
|
||||
});
|
||||
|
||||
return httpBuilder;
|
||||
|
|
|
|||
|
|
@ -252,7 +252,6 @@ public static class IdentityServerBuilderExtensionsCore
|
|||
/// <returns></returns>
|
||||
public static IIdentityServerBuilder AddPluggableServices(this IIdentityServerBuilder builder)
|
||||
{
|
||||
builder.Services.TryAddTransient<ICancellationTokenProvider, DefaultCancellationTokenProvider>();
|
||||
builder.Services.TryAddTransient<IPersistedGrantService, DefaultPersistedGrantService>();
|
||||
builder.Services.TryAddTransient<IKeyMaterialService, DefaultKeyMaterialService>();
|
||||
builder.Services.TryAddTransient<ITokenService, DefaultTokenService>();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ internal class RegisteredImplementationsDiagnosticEntry(ServiceCollectionAccesso
|
|||
new(typeof(IBackChannelLogoutHttpClient), [typeof(DefaultBackChannelLogoutHttpClient)]),
|
||||
new(typeof(IBackChannelLogoutService), [typeof(DefaultBackChannelLogoutService)]),
|
||||
new(typeof(ICache<>), [typeof(DefaultCache<>)]),
|
||||
new(typeof(ICancellationTokenProvider), [typeof(DefaultCancellationTokenProvider)]),
|
||||
new(typeof(IClaimsService), [typeof(DefaultClaimsService)]),
|
||||
new(typeof(IConsentService), [typeof(DefaultConsentService)]),
|
||||
new(typeof(ICorsPolicyService), [typeof(DefaultCorsPolicyService)]),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
|
|
@ -14,19 +14,16 @@ public class DefaultBackChannelLogoutHttpClient : IBackChannelLogoutHttpClient
|
|||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly ILogger<DefaultBackChannelLogoutHttpClient> _logger;
|
||||
private readonly ICancellationTokenProvider _cancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for BackChannelLogoutHttpClient.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="loggerFactory"></param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
public DefaultBackChannelLogoutHttpClient(HttpClient client, ILoggerFactory loggerFactory, ICancellationTokenProvider cancellationTokenProvider)
|
||||
public DefaultBackChannelLogoutHttpClient(HttpClient client, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_client = client;
|
||||
_logger = loggerFactory.CreateLogger<DefaultBackChannelLogoutHttpClient>();
|
||||
_cancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Duende.IdentityServer.Services.Default;
|
||||
|
||||
/// <summary>
|
||||
/// Provides cancellation tokens based on the incoming http request
|
||||
/// </summary>
|
||||
internal class DefaultCancellationTokenProvider : ICancellationTokenProvider
|
||||
{
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="httpContextAccessor"></param>
|
||||
public DefaultCancellationTokenProvider(IHttpContextAccessor httpContextAccessor) => _httpContextAccessor = httpContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to the cancellation token from the http context
|
||||
/// </summary>
|
||||
public CT CancellationToken => _httpContextAccessor.HttpContext?.RequestAborted ?? CT.None;
|
||||
}
|
||||
|
|
@ -18,7 +18,6 @@ public class DefaultJwtRequestUriHttpClient : IJwtRequestUriHttpClient
|
|||
private readonly HttpClient _client;
|
||||
private readonly IdentityServerOptions _options;
|
||||
private readonly SanitizedLogger<DefaultJwtRequestUriHttpClient> _sanitizedLogger;
|
||||
private readonly ICancellationTokenProvider _cancellationTokenProvider;
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
|
|
@ -26,14 +25,12 @@ public class DefaultJwtRequestUriHttpClient : IJwtRequestUriHttpClient
|
|||
/// <param name="client">An HTTP client</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="loggerFactory">The logger factory</param>
|
||||
/// <param name="cancellationTokenProvider"></param>
|
||||
public DefaultJwtRequestUriHttpClient(HttpClient client, IdentityServerOptions options,
|
||||
ILoggerFactory loggerFactory, ICancellationTokenProvider cancellationTokenProvider)
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_client = client;
|
||||
_options = options;
|
||||
_sanitizedLogger = new SanitizedLogger<DefaultJwtRequestUriHttpClient>(loggerFactory.CreateLogger<DefaultJwtRequestUriHttpClient>());
|
||||
_cancellationTokenProvider = cancellationTokenProvider;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Duende.IdentityServer.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service to provide CancellationToken for async operations.
|
||||
/// </summary>
|
||||
public interface ICancellationTokenProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the current CancellationToken, or null if none present.
|
||||
/// </summary>
|
||||
CT CancellationToken { get; }
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Duende.IdentityServer.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of ICancellationTokenProvider that returns CancellationToken.None
|
||||
/// </summary>
|
||||
public class NoneCancellationTokenProvider : ICancellationTokenProvider
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public CT CancellationToken => CT.None;
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using Duende.IdentityServer.Services;
|
||||
|
||||
namespace Duende.IdentityServer.IntegrationTests.Common;
|
||||
|
||||
public class MockCancellationTokenProvider : ICancellationTokenProvider
|
||||
{
|
||||
public CancellationToken CancellationToken => CancellationToken.None;
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ using Duende.IdentityServer.EntityFramework.Options;
|
|||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.IntegrationTests.Common;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
|
||||
using Duende.IdentityServer.Services.KeyManagement;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Duende.IdentityServer.Test;
|
||||
|
|
@ -80,8 +80,7 @@ public class EntityFrameworkBasedLogoutTests
|
|||
_mockPipeline.OnPostConfigureServices += services =>
|
||||
{
|
||||
//Override the default developer signing key store and signing credential store with the EF based implementations to repo bug specific to concurrent access to an EF db context
|
||||
services.AddSingleton<ISigningKeyStore>(new SigningKeyStore(context, new NullLogger<SigningKeyStore>(),
|
||||
new NoneCancellationTokenProvider()));
|
||||
services.AddSingleton<ISigningKeyStore>(new SigningKeyStore(context, new NullLogger<SigningKeyStore>()));
|
||||
services.Replace(ServiceDescriptor.Singleton<ISigningCredentialStore, AutomaticKeyManagerKeyStore>());
|
||||
};
|
||||
_mockPipeline.Initialize();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Duende.IdentityServer.EntityFramework.Mappers;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Services;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
|
|
@ -51,7 +50,7 @@ public class CorsPolicyServiceTests : IntegrationTest<CorsPolicyServiceTests, Co
|
|||
bool result;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>(), new NoneCancellationTokenProvider());
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>());
|
||||
result = await service.IsOriginAllowedAsync(testCorsOrigin, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ public class CorsPolicyServiceTests : IntegrationTest<CorsPolicyServiceTests, Co
|
|||
bool result;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>(), new NoneCancellationTokenProvider());
|
||||
var service = new CorsPolicyService(context, new NullLogger<CorsPolicyService>());
|
||||
result = await service.IsOriginAllowedAsync("InvalidOrigin", _ct);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Duende.IdentityServer.EntityFramework.Mappers;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
|
@ -31,7 +30,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
public async Task FindClientByIdAsync_WhenClientDoesNotExist_ExpectNull(DbContextOptions<ConfigurationDbContext> options)
|
||||
{
|
||||
await using var context = new ConfigurationDbContext(options);
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
var client = await store.FindClientByIdAsync(Guid.NewGuid().ToString(), _ct);
|
||||
client.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -54,7 +53,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
Client client;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
client = await store.FindClientByIdAsync(testClient.ClientId, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +87,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
Client client;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
client = await store.FindClientByIdAsync(testClient.ClientId, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +148,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
|
||||
const int timeout = 5000;
|
||||
var task = Task.Run(() => store.FindClientByIdAsync(testClient.ClientId, _ct));
|
||||
|
|
@ -183,7 +182,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
await using var context = new ConfigurationDbContext(freshOptions);
|
||||
await context.Database.EnsureCreatedAsync(_ct);
|
||||
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
|
||||
var clients = new List<Client>();
|
||||
await foreach (var client in store.GetAllClientsAsync(_ct))
|
||||
|
|
@ -216,7 +215,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
|
||||
var clients = new List<Client>();
|
||||
await foreach (var client in store.GetAllClientsAsync(_ct))
|
||||
|
|
@ -258,7 +257,7 @@ public class ClientStoreTests : IntegrationTest<ClientStoreTests, ConfigurationD
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ClientStore(context, new NullLogger<ClientStore>());
|
||||
|
||||
var clients = new List<Client>();
|
||||
await foreach (var c in store.GetAllClientsAsync(_ct))
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ using Duende.IdentityServer.EntityFramework.Entities;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal;
|
||||
|
|
@ -45,7 +44,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
await store.StoreDeviceAuthorizationAsync(deviceCode, userCode, data, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +72,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
await store.StoreDeviceAuthorizationAsync(deviceCode, userCode, data, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
|
||||
// skip odd behaviour of in-memory provider
|
||||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||
|
|
@ -167,7 +166,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
|
||||
// skip odd behaviour of in-memory provider
|
||||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||
|
|
@ -215,7 +214,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
DeviceCode code;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
code = await store.FindByUserCodeAsync(testUserCode, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +235,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
var code = await store.FindByUserCodeAsync($"user_{Guid.NewGuid().ToString()}", _ct);
|
||||
code.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -277,7 +276,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
DeviceCode code;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
code = await store.FindByDeviceCodeAsync(testDeviceCode, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +296,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
var code = await store.FindByDeviceCodeAsync($"device_{Guid.NewGuid().ToString()}", _ct);
|
||||
code.ShouldBeNull();
|
||||
}
|
||||
|
|
@ -347,7 +346,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
await store.UpdateByUserCodeAsync(testUserCode, authorizedDeviceCode, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -410,7 +409,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
await store.RemoveByDeviceCodeAsync(testDeviceCode, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +423,7 @@ public class DeviceFlowStoreTests : IntegrationTest<DeviceFlowStoreTests, Persis
|
|||
{
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new DeviceFlowStore(context, new PersistentGrantSerializer(), new NullLogger<DeviceFlowStore>());
|
||||
await store.RemoveByDeviceCodeAsync($"device_{Guid.NewGuid().ToString()}", _ct);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Duende.IdentityServer.EntityFramework.Mappers;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>());
|
||||
var item = await store.GetBySchemeAsync("scheme1", _ct);
|
||||
|
||||
item.ShouldNotBeNull();
|
||||
|
|
@ -68,7 +67,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>());
|
||||
var item = await store.GetBySchemeAsync("scheme2", _ct);
|
||||
|
||||
item.ShouldBeNull();
|
||||
|
|
@ -91,7 +90,7 @@ public class IdentityProviderStoreTests : IntegrationTest<IdentityProviderStoreT
|
|||
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new IdentityProviderStore(context, new NullLogger<IdentityProviderStore>());
|
||||
var item = await store.GetBySchemeAsync("scheme3", _ct);
|
||||
|
||||
item.ShouldBeNull();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Duende.IdentityServer.EntityFramework.Mappers;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
|
@ -46,7 +45,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
await store.StoreAsync(persistedGrant, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +70,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PersistedGrant foundPersistedGrant;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
foundPersistedGrant = await store.GetAsync(persistedGrant.Key, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +91,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
IList<PersistedGrant> foundPersistedGrants;
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
foundPersistedGrants = (await store.GetAllAsync(new PersistedGrantFilter { SubjectId = persistedGrant.SubjectId }, _ct)).ToList();
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +120,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
(await store.GetAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -193,7 +192,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
await store.RemoveAsync(persistedGrant.Key, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +216,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
SubjectId = persistedGrant.SubjectId,
|
||||
|
|
@ -245,7 +244,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
SubjectId = persistedGrant.SubjectId,
|
||||
|
|
@ -287,7 +286,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -299,7 +298,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -311,7 +310,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -324,7 +323,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -337,7 +336,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -350,7 +349,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -363,7 +362,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -377,7 +376,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -391,7 +390,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -406,7 +405,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
PopulateDb();
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
|
||||
await store.RemoveAllAsync(new PersistedGrantFilter
|
||||
{
|
||||
|
|
@ -432,7 +431,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
await store.StoreAsync(persistedGrant, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -457,7 +456,7 @@ public class PersistedGrantStoreTests : IntegrationTest<PersistedGrantStoreTests
|
|||
var newDate = persistedGrant.Expiration.Value.AddHours(1);
|
||||
await using (var context = new PersistedGrantDbContext(options))
|
||||
{
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new PersistedGrantStore(context, new NullLogger<PersistedGrantStore>());
|
||||
persistedGrant.Expiration = newDate;
|
||||
await store.StoreAsync(persistedGrant, _ct);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using Duende.IdentityServer.EntityFramework.Mappers;
|
|||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Stores;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
|
|
@ -77,7 +76,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
ApiResource foundResource;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
foundResource = (await store.FindApiResourcesByNameAsync(new[] { resource.Name }, _ct)).SingleOrDefault();
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +105,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
ApiResource foundResource;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
foundResource = (await store.FindApiResourcesByNameAsync(new[] { resource.Name }, _ct)).SingleOrDefault();
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +137,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IEnumerable<ApiResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = await store.FindApiResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
testApiScope.Name
|
||||
|
|
@ -172,7 +171,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IEnumerable<ApiResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = await store.FindApiResourcesByScopeNameAsync(new[] { testApiScope.Name }, _ct);
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +194,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<IdentityResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = (await store.FindIdentityResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -226,7 +225,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<IdentityResource> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = (await store.FindIdentityResourcesByScopeNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -252,7 +251,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<ApiScope> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = (await store.FindApiScopesByNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -283,7 +282,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
IList<ApiScope> resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = (await store.FindApiScopesByNameAsync(new List<string>
|
||||
{
|
||||
resource.Name
|
||||
|
|
@ -330,7 +329,7 @@ public class ScopeStoreTests : IntegrationTest<ScopeStoreTests, ConfigurationDbC
|
|||
Resources resources;
|
||||
await using (var context = new ConfigurationDbContext(options))
|
||||
{
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>(), new NoneCancellationTokenProvider());
|
||||
var store = new ResourceStore(context, new NullLogger<ResourceStore>());
|
||||
resources = await store.GetAllResourcesAsync(_ct);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ using Duende.IdentityServer.Configuration;
|
|||
using Duende.IdentityServer.Configuration.EntityFramework;
|
||||
using Duende.IdentityServer.EntityFramework.Options;
|
||||
using Duende.IdentityServer.EntityFramework.Storage;
|
||||
using Duende.IdentityServer.IntegrationTests.Common;
|
||||
using Duende.IdentityServer.IntegrationTests.TestFramework;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
|
|
@ -32,8 +30,6 @@ public class ConfigurationHost : GenericHost
|
|||
services.AddRouting();
|
||||
services.AddAuthorization();
|
||||
|
||||
services.AddSingleton<ICancellationTokenProvider, MockCancellationTokenProvider>();
|
||||
|
||||
services.AddIdentityServerConfiguration(opt =>
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ internal static class Factory
|
|||
new LoggerFactory().CreateLogger<JwtRequestValidator>());
|
||||
jwtRequestUriHttpClient ??= new DefaultJwtRequestUriHttpClient(
|
||||
new HttpClient(new NetworkHandler(new Exception("no jwt request uri response configured"))), options,
|
||||
new LoggerFactory(), new NoneCancellationTokenProvider());
|
||||
new LoggerFactory());
|
||||
pushedAuthorizationService ??= new TestPushedAuthorizationService();
|
||||
options ??= TestIdentityServerOptions.Create();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue