【发布时间】:2017-06-20 04:29:32
【问题描述】:
我正在尝试使用 WSO2 中的 OpenID Connect 服务提供商从自定义 Web 应用程序验证用户。我正在关注this article 上的答案,并添加了 Nuget 包 Thinktecture.IdentityModel.Client。我的代码与链接的文章非常相似:
var client = new OAuth2Client(new Uri(serviceProviderAuthorizeUrl));
var url = client.CreateImplicitFlowUrl(
clientId,
redirectUri: redirectUrl,
scope: scope,
nonce: Guid.NewGuid().ToString());
Response.Redirect(url);
网址是:https://{wso2_url}/oauth2/authorize?client_id={my_client_id}&response_type=token&scope=openid&redirect_uri=https%3A%2F%2F{mydomain}%2F{my_app}%2FCallback.aspx&nonce=f0db4eac-18df-46f6-92f1-c28ba621596d
现在这确实有效并返回了一个 access_token:https://{my_domain}/{my_app}/Callback.aspx#token_type=Bearer&expires_in=970&access_token=067e3366217798986912326a86abd92f
我的问题是我不知道用户是谁。此外,这个WSO2 article 表明,如果我传递了 response_type:id_token 我应该能够解码响应并使用“sub”属性找出用户是谁,但我没有得到 id_token 响应。上面的代码创建了一个带有 response_type 令牌的 url。只需更改 response_type 就会给我一个错误。如何在 WSO2 中使用隐式流并获取 id_token 响应?
我按照article 进行了 WSO2 的配置。我目前已检查隐式和客户端凭据。
【问题讨论】:
标签: wso2 wso2is openid-connect