【问题标题】:Application type users authenticating to GCP向 GCP 进行身份验证的应用程序类型用户
【发布时间】:2021-01-18 04:47:19
【问题描述】:

我正在寻找一种标准的 Oauth2.0 方法,供服务类型用户使用密钥对 GCP 环境中托管的 API 进行身份验证。我得到的最接近的是带有密钥对的service accounts

但是,我希望避免每次添加新的 service account 时都更新 ESP 配置(如下例所示)。

 securityDefinitions:
  service-1:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    x-google-issuer: "service-1@example-project-12345.iam.gserviceaccount.com"
    x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/service-1@example-project-12345.iam.gserviceaccount.com"
  service-2:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    x-google-issuer: "service-2@example-project-12345.iam.gserviceaccount.com"
    x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/service-2@example-project-12345.iam.gserviceaccount.com"

    #should be possible to leave the addition of service-X to the end client without needing to update this.

编辑:我尝试使用Identity PlatformESP 配置在添加新用户时不需要更新:

securityDefinitions:
    auth0:
        authorizationUrl: ""
        flow: "implicit"
        type: "oauth2"
        x-google-issuer: "https://securetoken.google.com/{google-project-ID}"
        x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
        x-google-audiences: "{google-project-ID}"

但是电子邮件/密码不是我的选项,GCP Identity Platform 似乎不支持用户提供机密信息,除非我遗漏了什么?

还可以添加针对用户的自定义声明,这样就无需在 API 代码中维护权限表。

Apigee 具有所有必需的功能,但对于我的项目需求来说,这似乎是一个昂贵的过度复杂化。

【问题讨论】:

  • Identity Platform 允许用户 authenticate 访问您的应用和服务,例如多租户 SaaS 应用、移动/Web 应用、游戏、API 等。您可以探索Authentication strategies。要创建用户,您可能需要探索类似于 Azure AD 的 G-Suite。你能用你的用例解释这个问题吗?
  • 我需要使用机密(最好有可能添加声明)而不是电子邮件/密码来创建用户。
  • 您可以使用 GCP Secret Manager创建秘密
  • 如何使用来自Secret Manager 的秘密和用户的 OAuth 身份验证?
  • 该功能目前似乎不可用。我建议您使用public issue tracker 提出问题

标签: google-cloud-platform oauth-2.0 api-gateway google-cloud-api-gateway


【解决方案1】:

Identity-Aware Proxy 为我的用例提供了功能。 添加服务帐户时,只需设置IAP-secured Web App User,它将可以访问受保护的资源。 google doc here

【讨论】:

    猜你喜欢
    • 2013-06-01
    • 2021-10-21
    • 2011-06-27
    • 2020-07-20
    • 2017-05-06
    • 2014-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多