ASP.net 5 中的 IApplicationBuilder.UseJwtBearerAuthentication 扩展在哪里?

Where is IApplicationBuilder.UseJwtBearerAuthentication extension in ASP.net 5?

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

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

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

这取决于您的运行时版本。在 beta7 中,该包称为 Microsoft.AspNet.Authentication.OAuthBearer, while in beta 8 the package is renamed to Microsoft.AspNet.Authentication.JwtBearer

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

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

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

RC2中有

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