gpt4 book ai didi

email - 在授权代码流程中使用时,id_token 是否应包含声明

转载 作者:行者123 更新时间:2023-12-01 03:12:52 25 4
gpt4 key购买 nike

使用 response_type=code 对支持 OpenID 的 OAuth2 授权服务器进行身份验证后与 scope=openid email ,调用 token 端点应返回 id_token .

我缺少的是这是否id_token应该包含 email与否 - 在这种情况下,客户应调用 userInfo端点。

规范说:

http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims

The Claims requested by the profile, email, address, and phone scope values are returned from the UserInfo Endpoint, as described in Section 5.3.2, when a response_type value is used that results in an Access Token being issued. However, when no Access Token is issued (which is the case for the response_type value id_token), the resulting Claims are returned in the ID Token.



据我了解,这意味着 id_token不需要包含 email如果 access_token可用作 userInfo应该被调用来获取它。然而,在 https://github.com/bitly/oauth2_proxy 中查看 oidc 客户端的实现看来他们确实需要 email声称在内部可用 id_token无需调用 userInfo端点。

OpenID 兼容授权服务器中的正确行为是什么?

最佳答案

openid 规范比 Google 或 Microsoft 正在做的更严格(可能其他提供商也是如此,但我没有检查)。
我猜 oauth2_proxy 保留了提供者的行为。
例如谷歌,返回 id_token交换时您要求的范围内的所有权利要求codeaccess_token .但是如果你阅读他们的文档,他们会指定 userInfo端点:
https://developers.google.com/identity/protocols/OpenIDConnect

我想只要你支持所有的端点,目标是否返回id_token连同所有权利要求以及 access_token你决定。它删除了对 userInfo 的一个额外调用。在大多数情况下,它不会暴露任何漏洞。

关于email - 在授权代码流程中使用时,id_token 是否应包含声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50740532/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com