通过OAuth2.0 Flow模拟Google Cloud Patform用户
我想为可以访问GCP的用户设置OAuth2.0流量。
用户将登录到Web应用程序。
然后,OAuth2.0流将需要征得同意,以允许该应用程序根据其权限代表他们执行事情。
因此,需要要求的范围应为涵盖其在GCP上实际权限的范围。
当涉及OAuth2.0和GCP时,类似的事情是可能的吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你看过吗? https://develovelers.google.com/identity/enteity/prototocols/oauth2
看起来像这样可能会解决您的问题。
与该链接分开 - >是的,这是可以做的。您可以通过Oauth登录,一旦验证服务可以使用GCP服务帐户使用GCP服务。
Had you seen? https://developers.google.com/identity/protocols/oauth2
Looks like that might address your question.
Separately from that link --> Yes that is something that could be done. You login via OAuth, and once authenticated that service can use GCP Service Accounts https://cloud.google.com/iam/docs/service-accounts to work with GCP Services.
可以授予用户假冒服务帐户的权限。
可以授予服务帐户,以通过域广泛的代表团(Google Workspace)模拟用户帐户。
用户不能冒充另一个用户。没有授予所需权限的机制。
A user can be granted permission to impersonate a service account.
A service account can be granted permission to impersonate a user account via Domain Wide Delegation (Google Workspace).
A user cannot impersonate another user. There is no mechanism to grant the required permissions.
在GCP项目中,您可以使用这些类型的凭据访问Google API:
因此,回答您的问题,在GCP中使用OAUTH 2.0肯定是可能的。
但是,不知道您的应用程序需要访问的数据,很难确定使用服务帐户或OAuth 2.0客户端是否更合适。在GCP项目中,如果您转到
apis and Services>凭据>创建证书>帮助我选择
,向导将指导您完成为每个身份验证方案创建最合适的凭据的过程:你这样说:
您是说这些用户拥有一个可以访问项目中使用的Google API的Google帐户?如果是这样,并且您的项目不需要访问用户的数据,那么服务帐户可能比OAuth 2.0同意屏幕更好。我认为您可以让服务帐户通过域名委托会模仿用户,但请记住, google本身不鼓励此功能。
另请参见创建Access Access凭据。
In a GCP project you can access Google APIs using these types of credentials:
So, to answer you question, using OAuth 2.0 in GCP is certainly possible.
However, without knowing what data your application needs to access, it's hard to tell if it's more appropriate to use a service account or an OAuth 2.0 client. In a GCP project, if you go to
APIs and services > Credentials > CREATE CREDENTIALS > Help me choose
, a wizard will guide you through the process of creating the most appropriate credential for each authentication scenario:Lastly, when you say this:
Do you mean that these users have a Google account that can access the Google APIs used in your project? If that's the case, and your project doesn't need to access user's data, then a service account might be a better choice than an OAuth 2.0 consent screen. I think you could let a service account impersonate a user via Domain Wide Delegation, but please keep in mind that Google itself discourages this feature.
See also Create access credentials.