diff --git a/src/Microsoft.AspNetCore.Authentication.Core/AuthenticationCoreServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Authentication.Core/AuthenticationCoreServiceCollectionExtensions.cs index 9089761d..fdf85a9b 100644 --- a/src/Microsoft.AspNetCore.Authentication.Core/AuthenticationCoreServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Authentication.Core/AuthenticationCoreServiceCollectionExtensions.cs @@ -4,8 +4,6 @@ using System; using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options.Infrastructure; namespace Microsoft.Extensions.DependencyInjection { @@ -30,7 +28,6 @@ public static IServiceCollection AddAuthenticationCore(this IServiceCollection s services.TryAddSingleton(); // Can be replaced with scoped ones that use DbContext services.TryAddScoped(); services.TryAddSingleton(); - services.AddTransient, DefaultConfigureOptions>(); return services; } @@ -55,13 +52,5 @@ public static IServiceCollection AddAuthenticationCore(this IServiceCollection s services.Configure(configureOptions); return services; } - - private class DefaultConfigureOptions : ConfigureDefaultOptions - { - public DefaultConfigureOptions(IConfiguration config) : - base(options => config.GetSection("Microsoft:AspNetCore:Authentication").Bind(options)) - { } - } - } } diff --git a/src/Microsoft.AspNetCore.Authentication.Core/Microsoft.AspNetCore.Authentication.Core.csproj b/src/Microsoft.AspNetCore.Authentication.Core/Microsoft.AspNetCore.Authentication.Core.csproj index 94550732..0ceaa4d3 100644 --- a/src/Microsoft.AspNetCore.Authentication.Core/Microsoft.AspNetCore.Authentication.Core.csproj +++ b/src/Microsoft.AspNetCore.Authentication.Core/Microsoft.AspNetCore.Authentication.Core.csproj @@ -15,7 +15,6 @@ - diff --git a/test/Microsoft.AspNetCore.Authentication.Core.Test/ConfigTests.cs b/test/Microsoft.AspNetCore.Authentication.Core.Test/ConfigTests.cs deleted file mode 100644 index 31c3ee50..00000000 --- a/test/Microsoft.AspNetCore.Authentication.Core.Test/ConfigTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Microsoft.Extensions.Options.Infrastructure; -using Xunit; - -namespace Microsoft.AspNetCore.Authentication -{ - public class ConfigTests - { - [Fact] - public void AddCanBindAgainstDefaultConfig() - { - var dic = new Dictionary - { - {"Microsoft:AspNetCore:Authentication:DefaultSignInScheme", ""}, - {"Microsoft:AspNetCore:Authentication:DefaultAuthenticateScheme", ""}, - {"Microsoft:AspNetCore:Authentication:DefaultChallengeScheme", ""} - }; - var configurationBuilder = new ConfigurationBuilder(); - configurationBuilder.AddInMemoryCollection(dic); - var config = configurationBuilder.Build(); - var services = new ServiceCollection() - .AddOptions() - .AddSingleton, ConfigureDefaults>() - .AddAuthenticationCore() - .AddSingleton(config); - var sp = services.BuildServiceProvider(); - - var options = sp.GetRequiredService>().Value; - Assert.Equal("", options.DefaultAuthenticateScheme); - Assert.Equal("", options.DefaultChallengeScheme); - Assert.Equal("", options.DefaultSignInScheme); - } - } -}