如何在 ProfileDataRequestContext 中包含 access_token 声明?
How do I include the access_token claims in the ProfileDataRequestContext?
这是我之前问题 的后续问题。我的问题是关于当我查询自定义 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
这种期望是错误的 - userinfo 是一个 OpenID Connect 概念,是获取声明的另一种方式,否则声明将包含在身份令牌中。不是访问令牌。
就是说 - 在您的用户服务的 GetProfileDataAsync
方法中,您可以从上下文中检测到您是否通过 userinfo 端点被调用,并且可以 return 任何您喜欢的声明。
这是我之前问题 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
这种期望是错误的 - userinfo 是一个 OpenID Connect 概念,是获取声明的另一种方式,否则声明将包含在身份令牌中。不是访问令牌。
就是说 - 在您的用户服务的 GetProfileDataAsync
方法中,您可以从上下文中检测到您是否通过 userinfo 端点被调用,并且可以 return 任何您喜欢的声明。