通过OAuth2.0 Flow模拟Google Cloud Patform用户

发布于 2025-02-12 03:52:00 字数 177 浏览 5 评论 0 原文

我想为可以访问GCP的用户设置OAuth2.0流量。

用户将登录到Web应用程序。

然后,OAuth2.0流将需要征得同意,以允许该应用程序根据其权限代表他们执行事情。

因此,需要要求的范围应为涵盖其在GCP上实际权限的范围。

当涉及OAuth2.0和GCP时,类似的事情是可能的吗?

I want to set up an OAuth2.0 flow for users that have access to GCP.

The user will login to a web app.

Then, the OAuth2.0 flow will need to ask for the consent that will allow the app to perform things on their behalf, based on their permissions.

Therefore, the scopes that need to be requested should be those that cover their actual permissions on GCP.

Is something like that possible when it comes to OAuth2.0 and GCP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

各自安好 2025-02-19 03:52:00

你看过吗? 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.

感情旳空白 2025-02-19 03:52:00

可以授予用户假冒服务帐户的权限。

可以授予服务帐户,以通过域广泛的代表团(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.

白况 2025-02-19 03:52:00

在GCP项目中,您可以使用这些类型的凭据访问Google API:

  1. API KEYS
  2. OAUTH 2.0客户端IDS
  3. 服务帐户,

因此,回答您的问题,在GCP中使用OAUTH 2.0肯定是可能的。

但是,不知道您的应用程序需要访问的数据,很难确定使用服务帐户或OAuth 2.0客户端是否更合适。在GCP项目中,如果您转到 apis and Services>凭据>创建证书>帮助我选择,向导将指导您完成为每个身份验证方案创建最合适的凭据的过程:

”

你这样说:

对于可以访问GCP

的用户

您是说这些用户拥有一个可以访问项目中使用的Google API的Google帐户?如果是这样,并且您的项目不需要访问用户的数据,那么服务帐户可能比OAuth 2.0同意屏幕更好。我认为您可以让服务帐户通过域名委托会模仿用户,但请记住, google本身不鼓励此功能

另请参见创建Access Access凭据

In a GCP project you can access Google APIs using these types of credentials:

  1. API keys
  2. OAuth 2.0 client IDs
  3. service accounts

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:

The "Help me choose" wizard when creating a new credential in Google Cloud

Lastly, when you say this:

for users that have access to GCP

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文