【发布时间】:2020-10-29 00:52:50
【问题描述】:
我正在使用 Microsoft 身份验证设置 social sign-in provider authentication without ASP.NET Core Identity。链接教程以 Google 为例,并提供代码来获取 DefaultChallengeScheme 的身份验证方案。
Microsoft 的身份验证方案是什么?我一直找不到它。
我的 Startup.cs > ConfigureServices 方法:
public void ConfigureServices(IServiceCollection services)
{
//set up using this tutorial https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/social-without-identity?view=aspnetcore-2.2
services
.AddAuthentication(authenticationOptions =>
{
authenticationOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
authenticationOptions.DefaultChallengeScheme = //??? what goes here
})
.AddCookie()
.AddMicrosoftAccount(microsoftOptions =>
{
microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ClientId"];
microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
【问题讨论】:
-
最有可能:
authenticationOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;见docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/…
标签: c# asp.net asp.net-core authentication