using Bit.Identity.IdentityServer;
namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionExtensions
{
///
/// Registers a custom for the given identifier to be called when a client id with
/// the identifier is attempting authentication.
///
/// Your custom implementation of .
/// The service collection to add services to.
///
/// The identifier to be used to invoke your client provider if a client_id is prefixed with your identifier
/// then your implementation will be invoked with the data after the seperating ..
///
/// The for additional chaining.
public static IServiceCollection AddClientProvider(this IServiceCollection services, string identifier)
where T : class, IClientProvider
{
ArgumentNullException.ThrowIfNull(services);
ArgumentException.ThrowIfNullOrWhiteSpace(identifier);
services.AddKeyedTransient(identifier);
return services;
}
}