具有asp.net核心的Windows身份验证 [英] Windows Authentication with asp.net core

查看:93
本文介绍了具有asp.net核心的Windows身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请提供有关如何在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:


  1. 打开project.json并将WebListener添加到依赖项:

  1. 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身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆