Add AddAuthentication(defaultScheme) overload
This commit is contained in:
parent
38d33cfbf2
commit
df325deaf3
|
|
@ -27,6 +27,9 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
return new AuthenticationBuilder(services);
|
||||
}
|
||||
|
||||
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services, string defaultScheme)
|
||||
=> services.AddAuthentication(o => o.DefaultScheme = defaultScheme);
|
||||
|
||||
public static AuthenticationBuilder AddAuthentication(this IServiceCollection services, Action<AuthenticationOptions> configureOptions) {
|
||||
if (services == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1247,7 +1247,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
|
|||
=> CreateServerWithServices(s =>
|
||||
{
|
||||
s.AddSingleton<ISystemClock>(_clock);
|
||||
s.AddAuthentication(o => o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(configureOptions);
|
||||
s.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(configureOptions);
|
||||
s.AddSingleton<IClaimsTransformation, ClaimsTransformer>();
|
||||
}, testpath, baseAddress);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,10 +79,7 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
|
|||
},
|
||||
services =>
|
||||
{
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultScheme = "External";
|
||||
})
|
||||
services.AddAuthentication("External")
|
||||
.AddCookie("External", o => { })
|
||||
.AddFacebook(o =>
|
||||
{
|
||||
|
|
@ -218,10 +215,7 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
|
|||
app => app.UseAuthentication(),
|
||||
services =>
|
||||
{
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
})
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie()
|
||||
.AddFacebook(o =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -748,7 +748,7 @@ namespace Microsoft.AspNetCore.Authentication.JwtBearer
|
|||
}
|
||||
});
|
||||
})
|
||||
.ConfigureServices(services => services.AddAuthentication(o => o.DefaultScheme = JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options));
|
||||
.ConfigureServices(services => services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options));
|
||||
|
||||
return new TestServer(builder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,11 +224,7 @@ namespace Microsoft.AspNetCore.Authentication.Tests.MicrosoftAccount
|
|||
})
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddAuthentication(o =>
|
||||
{
|
||||
o.DefaultScheme = TestExtensions.CookieAuthenticationScheme;
|
||||
});
|
||||
services.AddAuthentication()
|
||||
services.AddAuthentication(TestExtensions.CookieAuthenticationScheme)
|
||||
.AddCookie(TestExtensions.CookieAuthenticationScheme, o => { })
|
||||
.AddMicrosoftAccount(configureOptions);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -109,11 +109,7 @@ namespace Microsoft.AspNetCore.Authentication.Test.OpenIdConnect
|
|||
})
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddAuthentication(o =>
|
||||
{
|
||||
o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
|
||||
});
|
||||
services.AddAuthentication()
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie()
|
||||
.AddOpenIdConnect(options);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue