【问题标题】:Google Endpoints JWT Limited JWT claims pass-thruGoogle Endpoints JWT Limited JWT 声明传递
【发布时间】:2018-01-25 09:48:54
【问题描述】:

有没有办法请求特定的 JWT 声明显示在 Google Cloud Endpoints oauth 场景中的“X-Endpoint-API-UserInfo”标头中?

作为背景,我已成功让 Google Cloud Endpoints 从 Azure Oauth 验证我的 JWT 令牌,但是 Google Cloud Endpoints 在标头中传递的数据是有限的,并且没有充分包含来自原始声明的足够信息。

可在此处找到 Azure 提供的声明:https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code

例如

{ "aud": "2d4d11a2-f814-46a7-890a-274a72a7309e", "iss": "https://sts.windows.net/7fe81447-da57-4385-becb-6de57f21477e/", "iat": 1388440863, "nbf": 1388440863, "exp": 1388444763, "ver": "1.0", "tid": "7fe81447-da57-4385-becb-6de57f21477e", "oid": "68389ae2-62fa-4b18-91fe-53dd109d74f5", "upn": "frank@contoso.com", "unique_name": "frank@contoso.com", "sub": "JWvYdCWPhhlpS1Zsf7yYUxShUwtUm5yzPmw_-jX3fHY", "family_name": "Miller", "given_name": "Frank" }.

但是,Google Cloud Endpoints 仅返回此处指定的 3 个字段(颁发者、ID 和电子邮件):https://cloud.google.com/endpoints/docs/openapi/authenticating-users

如您所见,字段中存在错位,并且可能某些字段在端点中访问是有价值的。

【问题讨论】:

    标签: azure google-app-engine oauth-2.0 google-cloud-endpoints google-cloud-endpoints-v2


    【解决方案1】:

    此时,X-Endpoint-API-UserInfo 不会包含来自声明的任何其他信息,而不是记录在案的信息(即颁发者、ID 和电子邮件),但是,原始 JWT 令牌本身是传递的,因此您仍然可以提取额外的索赔表在那里。

    【讨论】:

    • 如何访问原始 JWT 令牌?
    • 对不起。忽略我的问题。我自己得到了。 JWT 中的有效载荷只是一个 base64 编码的字符串,可以轻松解码。
    猜你喜欢
    • 2018-06-25
    • 1970-01-01
    • 2020-03-31
    • 2018-05-08
    • 2019-07-18
    • 2017-01-15
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多