3

ASP.NET 5でOAuthAuthorizationServerMiddlewareandを登録するにはどうすればよいですか?OAuthBearerAuthenticationMiddleware

私は次のことを試しました:

app.UseMiddleware(typeof(OAuthAuthorizationServerMiddleware), OAuthServerOptions);
app.UseMiddleware(typeof(OAuthBearerAuthenticationMiddleware), new OAuthBearerAuthenticationOptions());

しかし、これは次のエラーをスローします:

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.

この (ここをクリック) アプリケーションに実装されているトークンベースの認証を ASP.NET 5 に移植しようとしています。

ここで壁にぶつかり、OAuth サーバーミドルウェアと OAuth Bearer 認証を登録できませんでした。

4

1 に答える 1

5

ASP.NET vNext プロジェクトの UseMiddleware メソッドで Katana プロジェクトのミドルウェアを使用することはできません。https://github.com/aspnet/HttpAbstractions/blob/335895d9b49042312eca12a089340adf3ca0a219/src/Microsoft.AspNet.Owin/OwinExtensions.csで提供されている UseOwin メソッドを試すことができますが、どのように機能するかはわかりません。

ここで最も賢明な決定は、あなたのものを新しい世界に移植することです. OAuth サーバー ミドルウェアの実装は、https ://github.com/aspnet/Security/tree/dev/src/Microsoft.AspNet.Security.OAuth にあります。

于 2014-10-23T16:29:14.820 に答える