【问题标题】:Where is IApplicationBuilder.UseJwtBearerAuthentication extension in ASP.net 5?ASP.net 5 中的 IApplicationBuilder.UseJwtBearerAuthentication 扩展在哪里?
【发布时间】:2015-09-22 19:48:00
【问题描述】:

我看到的例子表明IApplicationBuilder 有一个扩展方法.UseJwtBearerAuthentication(Action<?> options)

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

我唯一不同的是我使用的是-beta7,但我认为这无关紧要。

【问题讨论】:

    标签: asp.net-web-api asp.net-core asp.net-core-mvc


    【解决方案1】:

    这取决于您的运行时版本。在 beta7 中,包被称为 Microsoft.AspNet.Authentication.OAuthBearer,而在 beta 8 中,包被重命名为 Microsoft.AspNet.Authentication.JwtBearer

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

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

    专业提示:切勿混合使用 beta3 安全包和 beta7 MVC 包等 beta 版本。

    【讨论】:

    • 我得到 Microsoft.AspNet.Authentication.JwtBearer >= 1.0.0-beta7 无法解析。
    • @MickaelCaruso 抱歉,我忽略了这一点。我已经更新了我的帖子。
    • 谢谢。我在 project.json Intellisense 中看到了 *.OAuthBearer,所以可能就是这样。不过,很高兴知道 *.JwtBearer 在 beta8 中应该是这样的。
    【解决方案2】:

    在 RC2 中有

    Microsoft.AspNetCore.Authentication.JwtBearer
    Microsoft.AspNetCore.Authentication.OAuth
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-25
      • 2019-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      相关资源
      最近更新 更多