Registering OAuth Authorization Service Middleware
How can I register OAuthAuthorizationServerMiddleware
and OAuthBearerAuthenticationMiddleware
in ASP.NET 5?
I tried the following:
app.UseMiddleware(typeof(OAuthAuthorizationServerMiddleware), OAuthServerOptions);
app.UseMiddleware(typeof(OAuthBearerAuthenticationMiddleware), new OAuthBearerAuthenticationOptions());
But this throws the following error:
System.Exception: TODO: unable to locate suitable constructor for Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationMiddleware. Ensure 'instanceType' is concrete and all parameters are accepted by a constructor.
I am trying to do a token based token based authentication ( click here ) application in ASP.NET 5.
I hit the wall here with no way to register OAuth server middleware and OAuth Bearer authentication.
source to share
You cannot use middlewares from Katana project using UseMiddleware method in ASP.NET vNext project. You can try using the UseOwin method listed here: https://github.com/aspnet/HttpAbstractions/blob/335895d9b49042312eca12a089340adf3ca0a219/src/Microsoft.AspNet.Owin/OwinExtensions.cs but I'm not sure how it will work.
The wisest decision is to move your belongings to the new world. You can find OAuth server middleware implementations here: https://github.com/aspnet/Security/tree/dev/src/Microsoft.AspNet.Security.OAuth
source to share