gpt4 book ai didi

oauth - 如何为 OAuth2 访问 token 指定受众?

转载 作者:行者123 更新时间:2023-12-04 08:40:46 25 4
gpt4 key购买 nike

我很困惑,在向授权服务器发送授权请求时,似乎没有标准的方法来指定访问 token 的受众。

OAuth2 将访问 token 指定为不透明字符串;规范中只有一个提到“观众”,说访问 token 可能是“观众限制”。
许多最近的授权服务器实现似乎产生了 JWT 访问 token ,并且 JWT 指定了受众 (aud) 声明。

据我发现:
- Auth0 使用“观众”参数
- Connect2id 使用“资源”参数
- Identity Server 对“aud”声明使用固定的基于发行者的值,并假设范围足够了 - 但是,这并不适合所有用例。
- 优秀的“OAuth2 in Action”一书在“aud”声明中显示了一个带有资源服务器 URI 的示例,但没有说明它的来源。

那么,如何以标准方式获取特定受众(资源服务器、API 等)的访问 token ?

最佳答案

我想你是对的。有一些可用的指导方针。
The OAuth 2.0 Authorization Framework: Bearer Token Usage
OAuth 2.0: Audience Information (draft-tschofenig-oauth-audience-00.txt)

OpenID connect明确定义的“aud”参数为:

REQUIRED. Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 client_id of the Relying Party as an audience value. It MAY also contain identifiers for other audiences. In the general case, the aud value is an array of case sensitive strings. In the common special case when there is one audience, the aud value MAY be a single case sensitive string.

关于oauth - 如何为 OAuth2 访问 token 指定受众?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45876960/

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