2016-06-15 60 views
1

這是對我以前的問題here的後續問題。我的問題是關於何時查詢自定義UserInfoEndpoint我希望我的訪問令牌(作爲請求中的不記名令牌發送)中的聲明成爲上下文ProfileDataRequestContext的一部分。問題是他們不是,具體而言,我希望ticket聲明在上下文中,但上下文是空的(除了sub,據我瞭解總是存在)。如何在ProfileDataRequestContext中包含access_token聲明?

請參閱我的上一個問題關於實施,因爲我不想在這裏重新發布一切。

在此先感謝...

日誌以供參考......

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的問題,它被確定之後,這是不支持的,有人認爲,我把票放在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 

回答

2

這種期望是錯誤的 - 用戶信息是開放ID連接的概念,是一種替代方式去索賠,否則將在身份令牌。不是訪問令牌。

這就是說 - 在您的用戶服務的GetProfileDataAsync方法中,您可以從上下文中檢測是否通過userinfo端點調用,並且可以返回任何您喜歡的聲明。