在Web API 2中,您过go 可以通过如下中间件设置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中实现这一点.净核心.我已经查看了源代码(https://github.com/aspnet/Security),但我没有看到任何类似的内容.有没有新的方法来实现这一点?我需要创建一个控制器并自己做吗?
我知道如何通过中间件设置OAuth身份验证,但这涉及到授权部分,在授权部分,我从API发出声明.