【问题标题】:How do I include the access_token claims in the ProfileDataRequestContext?如何在 ProfileDataRequestContext 中包含 access_token 声明?
【发布时间】:2016-10-17 01:40:51
【问题描述】:

这是我之前的问题here 的后续问题。我的问题是关于当我查询自定义 UserInfoEndpoint 时,我希望来自我的访问令牌(在请求中作为不记名令牌发送)的声明成为上下文 ProfileDataRequestContext 的一部分。问题是它们不是,特别是我希望 ticket 声明在上下文中,但是上下文是空的(sub 除外,据我所知它始终存在)。

请参阅我之前关于实施的问题,因为我不想在这里重新发布所有内容。

提前谢谢...

日志供参考...

2016-06-15 13:52:11.508 -05:00 [Information] Creating userinfo response
2016-06-15 13:52:11.513 -05:00 [Information] Scopes in access token: "app openid offline_access appaccess"
2016-06-15 13:52:11.514 -05:00 [Information] Requested claim types: "applicationDto sub"
2016-06-15 13:52:11.514 -05:00 [Debug] Getting ProfileDataAsync
2016-06-15 13:52:11.514 -05:00 [Debug] The claims in the context...
2016-06-15 13:52:11.514 -05:00 [Debug] Claims sub 783bf872-b864-4042-853d-04fbcb7a505a
2016-06-15 13:52:11.514 -05:00 [Debug] The requseted claims...
2016-06-15 13:52:11.514 -05:00 [Debug] Cliams applicationDto
2016-06-15 13:52:11.514 -05:00 [Debug] Cliams sub
2016-06-15 13:52:11.514 -05:00 [Debug] Finished ProfileDataAsync
2016-06-15 13:52:11.514 -05:00 [Information] Profile service returned to the following claim types: "sub"
2016-06-15 13:52:11.514 -05:00 [Information] End userinfo request
2016-06-15 13:52:11.516 -05:00 [Information] Returning userinfo response.

更新: 在github讨论了这个问题,确定不支持,建议我把ticket放到id_token里面,但是还是不能解决问题。

有什么方法可以让ticket 声明作为 UserInfoEndpoint 中上下文的一部分?

更新后的日志...

2016-06-16 12:23:08.023 -05:00 [Information] Creating userinfo response
2016-06-16 12:23:08.027 -05:00 [Information] Scopes in access token: "app openid offline_access appaccess"
2016-06-16 12:23:08.028 -05:00 [Information] Requested claim types: "applicationDto sub ticket"
2016-06-16 12:23:08.028 -05:00 [Debug] Getting ProfileDataAsync
2016-06-16 12:23:08.028 -05:00 [Debug] Claims in Claims in the context...
2016-06-16 12:23:08.028 -05:00 [Debug]     "sub : 783bf872-b864-4042-853d-04fbcb7a505a"     
2016-06-16 12:23:08.028 -05:00 [Debug] Claims in Requested Claims...
2016-06-16 12:23:08.028 -05:00 [Debug]     "applicationDto"     
2016-06-16 12:23:08.028 -05:00 [Debug]     "sub"     
2016-06-16 12:23:08.028 -05:00 [Debug]     "ticket"     
2016-06-16 12:23:08.028 -05:00 [Debug] Claims in Issued Claims...
2016-06-16 12:23:08.028 -05:00 [Debug]     "sub : 783bf872-b864-4042-853d-04fbcb7a505a"     
2016-06-16 12:23:08.028 -05:00 [Debug] Finished ProfileDataAsync

【问题讨论】:

    标签: c# .net oauth-2.0 identityserver3


    【解决方案1】:

    这种期望是错误的 - userinfo 是一个 OpenID Connect 概念,并且是获取原本在身份令牌中的声明的另一种方式。不是访问令牌。

    也就是说 - 在您的用户服务中的 GetProfileDataAsync 方法中,您可以从上下文中检测您是否通过 userinfo 端点被调用,并且可以返回您喜欢的任何声明。

    【讨论】:

      猜你喜欢
      • 2020-06-16
      • 2020-01-08
      • 2017-05-31
      • 2020-01-23
      • 1970-01-01
      • 1970-01-01
      • 2016-06-18
      • 1970-01-01
      • 2012-01-28
      相关资源
      最近更新 更多