【发布时间】:2018-03-09 22:06:40
【问题描述】:
在 ASP.NET Core 1.x 中,我可以在 Configure 中使用身份验证方法,但现在在 ASP.NET Core 2.0 中,我必须在 ConfigureServices 并且无法在 Configure 方法中进行配置。例如
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication()
.AddCookie()
.AddXX();
}
然后在
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
....
app.UseAuthentication();
}
在过去,我可以使用类似的东西
app.UseOpenIdConnectAuthentication();
我不能再这样配置了。
那么我现在如何在 ASP.NET Core 2.0 中使用这样的东西?
app.Map(new PathString("/MyPath"), i => i.UseMyAuthMethod());
【问题讨论】:
-
我在 github github.com/aspnet/Security/issues/1479#issuecomment-360928524找到了微软人的答案
标签: authentication asp.net-core asp.net-core-mvc