问题描述
我正在为服务类型的用户寻找一种标准的Oauth2.0方法,该服务类型的用户使用机密向GCP环境中托管的API进行身份验证。我得到的最接近的是带有密钥对的service accounts
。
但是,我想避免每次添加新的ESP
时都更新service account
的配置(例如下面的示例)。
securityDeFinitions:
service-1:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-issuer: "[email protected]"
x-google-jwks_uri: "https://www.googleapis.com/robot/v1/Metadata/x509/[email protected]"
service-2:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-issuer: "[email protected]"
x-google-jwks_uri: "https://www.googleapis.com/robot/v1/Metadata/x509/[email protected]"
#should be possible to leave the addition of service-X to the end client without needing to update this.
编辑:我尝试使用Identity Platform
和ESP
配置在添加新用户时不需要更新:
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-Aware Proxy
为我的用例提供了功能。
添加服务帐户时,只需设置IAP-secured Web App User
,它将有权访问受保护的资源。 google doc here