首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
daijinming
V2EX  ›  程序员

JWT 中的 aud 字段是什么意思

  •  
  •   daijinming · 2018-12-14 10:51:46 +08:00 · 1900 次点击
    这是一个创建于 402 天前的主题,其中的信息可能已经有所发展或是发生改变。

    JWT 中的 aud 字段是什么意思 Markdown 网上给出的解释都是 [接收 jwt 的一方] ,那具体怎么理解那?

    5 回复  |  直到 2018-12-14 12:02:53 +08:00
    wei745359223
        1
    wei745359223   2018-12-14 11:18:26 +08:00
    应该就是申请这个 token 的 client 信息 比如 IP 啥的?
    reus
        2
    reus   2018-12-14 11:30:52 +08:00
    audience
    用户 id 应该放这里的。
    jimzhong
        3
    jimzhong   2018-12-14 11:56:45 +08:00   ♥ 1
    audience, 接受 JWT 的一方。接受方须检查该字段以避免一些攻击。

    https://tools.ietf.org/html/rfc7519#section-4.1.3
    xomix
        4
    xomix   2018-12-14 11:57:57 +08:00
    // 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.

    客户端信息
    Vegetable
        5
    Vegetable   2018-12-14 12:02:53 +08:00
    The "aud" (audience) claim identifies the recipients that the JWT is
    intended for. Each principal intended to process the JWT MUST
    identify itself with a value in the audience claim. If the principal
    processing the claim does not identify itself with a value in the
    "aud" claim when this claim is present, then the JWT MUST be
    rejected. In the general case, the "aud" value is an array of case-
    sensitive strings, each containing a StringOrURI value. In the
    special case when the JWT has one audience, the "aud" value MAY be a
    single case-sensitive string containing a StringOrURI value. The
    interpretation of audience values is generally application specific.
    Use of this claim is OPTIONAL.
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2425 人在线   最高记录 5168   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.3 · 31ms · UTC 12:48 · PVG 20:48 · LAX 04:48 · JFK 07:48
    ♥ Do have faith in what you're doing.