加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 使用asp.net核心进行Windows身份验证

发布时间:2020-12-15 22:19:22 所属栏目:asp.Net 来源:网络整理
导读:请提供有关如何在ASP.NET Core RC2上实现 Windows身份验证的指导. 我看到其他SO问题描述了像Bearer Authentication with ASP.NET Core RC2 404 instead of 403这样的承载认证 但这不是我想要的. 解决方法 您可以使用WebListener执行此操作,如下所示: 打开pr
请提供有关如何在ASP.NET Core RC2上实现 Windows身份验证的指导.

我看到其他SO问题描述了像Bearer Authentication with ASP.NET Core RC2 404 instead of 403这样的承载认证

但这不是我想要的.

解决方法

您可以使用WebListener执行此操作,如下所示:

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

"dependencies" : {
  ...
  "Microsoft.AspNetCore.Server.WebListener": "0.1.0-rc2-final"
  ...
}

>将WebListener添加到命令(再次在Project.json中)

"commands": {
    "weblistener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener"
  },

>在Startup.cs中,指定WebHostBuilder以将WebListener与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();

而已!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读