【发布时间】:2015-05-17 07:22:21
【问题描述】:
在 Web API 2 中,您曾经能够通过如下中间件设置 OAuth 授权服务器来创建端点以发出令牌:
//Set up our auth server options.
var OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider()
};
// Sets up the token issue endpoint using the options above
app.UseOAuthAuthorizationServer(OAuthServerOptions);
也许我错过了它,但我正试图弄清楚如何在 ASP.NET Core 中执行此操作。我查看了源代码 (https://github.com/aspnet/Security),但我真的没有看到任何类似的东西。有没有一种新的方法可以做到这一点?我需要自己创建一个控制器并自己做吗?
我了解如何通过中间件设置 OAuth 身份验证,但这涉及我从 API 发出声明的授权部分。
【问题讨论】:
-
也许这会有所帮助。这是 thinktecture 身份服务器的答案:stackoverflow.com/questions/29360563/…
-
感谢@CedricDumont,我一直在寻找集成的东西,但我考虑过 Thinktecture。一天结束,这可能是我的选择。它非常坚固。
标签: asp.net oauth asp.net-core asp.net-core-mvc