google-cloud-auth
它能做什么
这项技能教你的智能体了解 Google Cloud 的身份验证工作方式。适合需要安全地将应用或用户连接到 Google Cloud 的开发人员和 IT 人员。
适用场景
- ✓需要为在笔记本电脑上开发 Google Cloud 的开发人员设置登录的时候。
- ✓运行在 Google Cloud 上的应用需要访问 Google 服务、又不想保存密码的时候。
- ✓想为脚本或库设置应用默认凭据(Application Default Credentials)的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/security/google-cloud-auth/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的应用跑在 Cloud Run 上,怎样才能访问 BigQuery,同时又不把密钥文件放进代码里?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体先询问代码运行在哪里、要连接什么,然后推荐合适的登录方式,例如应用默认凭据。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Authenticating to Google Cloud
Authentication is the process of proving who you are. In Google Cloud, you represent a Principal (an identity like a user or a service). This is the first step before Authorization (determining what you can do).
Authentication
Clarifying Questions for the Agent
Before providing a specific solution, clarify the following with the user:
- Who or what is authenticating? (A human developer, a local script, or an application running in production?)
- Where is the code running? (Local laptop, Compute Engine, GKE, Cloud Run, or another cloud like AWS/Azure?)
- What is the target? (A Google Cloud API like Storage/BigQuery, or a custom application you built?)
- Are you using a high-level client library? (e.g., Python, Go, Node.js libraries usually handle ADC automatically.)
Human Authentication
For users to access Google Cloud, they need an identity that Google Cloud can recognize.
Types of User Identities
Google Cloud supports several ways to configure identities for your internal workforce (developers, administrators, employees):
- Google-Managed Accounts: You can use Cloud Identity or Google Workspace to create managed user accounts. These are called managed accounts because your organization controls their lifecycle and configuration.
- Federation using Cloud Identity or Google Workspace: You can federate identities to allow users to use their existing identity and credentials to sign in to Google services. Users authenticate against an external identity provider (IdP), but you must keep accounts synchronized into Google Cloud using tools like Google Cloud Directory Sync (GCDS) or an external authoritative source like Active Directory or Microsoft Entra ID.
- Workforce Identity Federation: This lets you use an external IdP to authenticate and authorize a workforce using IAM directly. Unlike standard federation, you do not need to synchronize user identities from your existing IdP to Google Cloud identities. It supports syncless, attribute-based single sign-on.
Methods of Access for Developers and Administrators
Used for interacting with Google Cloud resources and APIs during development and management.
- Google Cloud Console: The primary web interface. You authenticate using your Google Account (Gmail or Google Workspace).
- gcloud CLI (
gcloud auth login): Used to authenticate the CLI itself so you can run management commands (e.g.,gcloud compute instances list). It uses a Credential (like an OAuth 2.0 refresh token) stored locally. - Local Development with App Default Credentials
(ADC)
(
gcloud auth application-default login): This is different from CLI auth. It creates a local JSON file that Google Cloud Client Libraries (Python, Java, etc.) use to act as "you" when you run code on your laptop. - Service Account
Impersonation:
For security reasons, developers should avoid downloading Service Account
keys entirely. Instead, they should authenticate as humans (
gcloud auth login) and use Service Account Impersonation to run CLI commands or generate short-lived credentials. This is a critical best practice for local development and troubleshooting.
For End-Users and Customers
Used when a human (who is not a developer) needs to access a web application you've deployed on Google Cloud. Note: These are distinct from workforce identities.
- Identity-Aware Proxy (IAP): Acts as a central authorization layer for web appl
常见问题
什么是应用默认凭据?
它是 Google Cloud 库自动查找正确凭据的标准方式。
涵盖服务账户吗?
涵盖。该技能既涵盖面向应用和服务的服务身份,也涵盖面向人类用户的身份。
它也涵盖权限吗?
它主要涵盖你是谁,并说明权限(即你能做什么)是在身份确认之后处理的。
详情
作者的原始描述
Provides expert guidance on authenticating and authorizing to Google Cloud services and APIs, covering human users, service identities, Application Default Credentials (ADC), and best practices for secure access.
热度
- GitHub 星标
- 33k
- 排名
- #9055
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。