Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I've seen examples that that indicate IApplicationBuilder has an extension method .UseJwtBearerAuthentication(Action<?> options).

This SO question and AspNet.Security.OpenIdConnect.Server sample server startup file seem to say that there is such an extension. On the OpenIdConnect, I looked at the extensions folder and I don't see an extension named UseJwtBearerAuthentication. Even this blog says that it's supposed to be included with ASP.net 5. I also tried adding Microsoft.AspNet.Security.OAuthBearer, 1.0.0-beta3 to my project.json and reference it in Startup.cs. No help.

The only thing I have different is that I'm using -beta7, but I don't think that should matter.

like image 677
Mickael Caruso Avatar asked Sep 22 '15 19:09

Mickael Caruso


2 Answers

It depends on your runtime version. In beta7 the package is called Microsoft.AspNet.Authentication.OAuthBearer, while in beta 8 the package is renamed to Microsoft.AspNet.Authentication.JwtBearer.

Since you are using beta7, add this to your project.json:

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

Pro-tip: never mix beta versions like beta3 security packages and beta7 MVC packages.

like image 88
Henk Mollema Avatar answered Oct 10 '22 18:10

Henk Mollema


In RC2, there are

Microsoft.AspNetCore.Authentication.JwtBearer
Microsoft.AspNetCore.Authentication.OAuth
like image 45
Blaise Avatar answered Oct 10 '22 17:10

Blaise