向 GCP 进行身份验证的应用程序类型用户

Application type users authenticating to GCP

我正在寻找一种标准的 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}"

但是 email/password 不适合我的情况,而且 GCP Identity Platform 似乎不支持有秘密的用户,除非我遗漏了什么?

最好能够添加针对用户的自定义声明,这样就无需在 API 代码中维护权限 table。

Apigee 具有所有必需的功能,但对于我的项目需求来说似乎过于复杂。

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