请提供有关如何在ASP.NET Core RC2 +上实现Windows身份验证的指南。
Please provide guidance on how to implement Windows Authentication on ASP.NET Core RC2+.
我看到了其他描述承载身份验证的SO问题,例如使用ASP.NET Core RC2 404(而不是403)进行承载者身份验证
I see other SO questions that describe bearer authentication like Bearer Authentication with ASP.NET Core RC2 404 instead of 403
但这不是我想要的。
推荐答案您可以使用WebListener来做到这一点,就像这样:
You can do this using WebListener, like so:
打开project.json并将WebListener添加到依赖项:
Open your project.json and add WebListener to dependencies: "dependencies" : { ... "Microsoft.AspNetCore.Server.WebListener": "0.1.0-rc2-final" ... }
添加命令的WebListener(同样在Project.json中)
Add WebListener to commands (again in Project.json)
"commands": { "weblistener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener" },
在Startup.cs中,指定WebHostBuilder以将WebListener与NTLM一起使用
In Startup.cs, specify the WebHostBuilder to use WebListener with NTLM
var host = new WebHostBuilder() // Some configuration .UseWebListener(options => options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM) // Also UseUrls() is mandatory if no configuration is used .Build();
就是这样!
更多推荐
具有asp.net核心的Windows身份验证
发布评论