对 Google Cloud Run REST api 的最终用户进行身份验证

问题描述 投票:0回答:1

我正在尝试调用 Cloud Run 服务(需要身份验证)端点。该用户是通过 Firebase 进行身份验证的公共最终用户。研究并尝试了一些指南,但无济于事。我也对云运行服务身份验证的用例数量感到困惑。

  1. 经过身份验证的 Firebase 用户具有 Cloud Run 管理员角色。
  2. 我收到 401 未经授权的错误
  3. 云运行服务是否应该设置为“允许未经身份验证”? (到目前为止,我已将其设置为“需要身份验证”)
  • 3A(是),那么我必须验证各个端点内的所有其余 api 调用?或者API网关之类的?
  • 3A.1 - Authenticate all rest api calls individually
    
  • 3A.2 - API Gateway
    
  • In terms of pricing, would it be better to use 3A.1, because as I understand it correctly, 3A.2 will incur charges for authenticating users through it. 
    
  • It's just that it seems too primitive that 3A.1 would have to be done in each endpoint. Am I missing something? 
    
  • 3B(否),那么为什么 Cloud Run 管理员角色用户仍然收到 401 未经授权的错误。
  1. 我看到的指南之一,https://cloud.google.com/run/docs/authenticating/end-users ...指出该服务应设置为公共,这是否意味着允许未经身份验证?请参见下图中的数字 2。
  • 4A - 那么,如果未经身份验证,那么我必须执行 3A?

enter image description here

提前致谢。

PS:我对GCP不太熟悉。

google-cloud-run google-iam
1个回答
0
投票

根据这些消息来源,我必须选择 3A。

  1. https://stackoverflow.com/a/64597885/7888262
  2. https://cloud.google.com/run/docs/tutorials/identity-platform

使用控制台或 CLI 将容器映像部署到 Cloud Run。请注意,服务器部署为允许未经身份验证的访问。这样用户就可以加载客户端并开始该过程。服务器手动验证添加到投票请求中的 id 令牌,从而对最终用户进行身份验证。

  1. https://cloud.google.com/run/docs/authenticating/end-users

公开部署您的 Cloud Run 服务。

© www.soinside.com 2019 - 2024. All rights reserved.