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

asp.net-web-api – ASP.net 5中的IApplicationBuilder.UseJwtBe

发布时间:2020-12-16 03:30:20 所属栏目:asp.Net 来源:网络整理
导读:我见过的例子表明IApplicationBuilder有一个扩展方法.UseJwtBearerAuthentication(Action? options). 这SO question和AspNet.Security.OpenIdConnect.Server sample server startup file似乎说有这样的延伸.在OpenIdConnect上,我查看了extensions文件夹,但
我见过的例子表明IApplicationBuilder有一个扩展方法.UseJwtBearerAuthentication(Action<?> options).

这SO question和AspNet.Security.OpenIdConnect.Server
sample server startup file似乎说有这样的延伸.在OpenIdConnect上,我查看了extensions文件夹,但没有看到名为UseJwtBearerAuthentication的扩展名.甚至this blog说它应该包含在ASP.net 5.我也尝试将Microsoft.AspNet.Security.OAuthBearer,1.0.0-beta3添加到我的project.json并在Startup.cs中引用它.没有帮助.

我唯一不同的是我正在使用-beta7,但我认为这不重要.

解决方法

这取决于您的运行时版本.在beta7中,该软件包称为 Microsoft.AspNet.Authentication.OAuthBearer,而在测试版8中,软件包重命名为 Microsoft.AspNet.Authentication.JwtBearer.

由于您使用的是beta7,请将其添加到project.json:

"Microsoft.AspNet.Authentication.OAuthBearer": "1.0.0-beta7"

专业提示:永远不要混合beta版安全包和beta7 MVC包等beta版本.

(编辑:李大同)

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

    推荐文章
      热点阅读