【发布时间】:2013-01-27 21:31:44
【问题描述】:
您好,我正在构建一个 ASP.Net WebApi。首先,我使用基本身份验证 .net 成员资格提供程序和 Thinktecture Identitymodel 授权了 WebApi。
var authConfig = new AuthenticationConfiguration();
authConfig.AddBasicAuthentication((username, password) => Membership.ValidateUser(username, password));
config.MessageHandlers.Add(new AuthenticationHandler(authConfig));
我想这再简单不过了。
为了更进一步,我设置了 Thinktecture IdentityServer,它为我提供了 oauth2 令牌。我的问题是如何使用身份服务器验证客户端发送给我的访问令牌(WebApi)?
我一直在研究 IdentityModel 提供的 AddJsonWebToken 方法,但我无法确定我应该调用身份服务器中的哪个 uri(端点)来验证令牌。可能我只是完全迷失在这里并且没有抓住重点,任何帮助都会非常感激!
总结一下:
如何验证我在 WebApi 中收到的 access_tokens 以及如何将其连接到 [Authorize] 属性?
【问题讨论】:
标签: asp.net-web-api authorization oauth-2.0 thinktecture-ident-model thinktecture-ident-server