在Google Cloud Endpoint oauth场景中,有没有办法请求特定的JWT声明显示在"X-Endpoint-API-UserInfo“头中?
作为背景,我已经成功地让Google Cloud Endpoint从Azure Oauth验证了我的JWT令牌,但是Google Cloud Endpoint在header中传递的数据是有限的,并且没有充分包含原始声明中的足够信息。
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 Endpoint仅返回此处指定的3个字段(颁发者、id和电子邮件):https://cloud.google.com/endpoints/docs/openapi/authenticating-users。
正如您所看到的,字段中存在未对齐的情况,并且可能存在一些在端点中具有访问价值的字段。
发布于 2017-11-10 15:36:13
目前,X-Endpoint-API-UserInfo不会包含来自索赔的任何文档以外的任何额外信息(即颁发者、id和电子邮件),但是,原始的JWT令牌本身是传递的,因此您仍然可以从那里提取额外的索赔。
https://stackoverflow.com/questions/47079984
复制相似问题