auth-implementation-patterns
它能做什么
这个工具可以帮你设计和审查应用的安全体系,确保只有获得授权的用户才能访问特定的信息和功能。
适用场景
- ✓给应用搭建用户登录系统时。
- ✓想保护应用信息,防止未经授权的访问时。
- ✓需要添加“使用 Google 登录”或“使用 Facebook 登录”这类登录方式时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/auth-implementation-patterns/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我设置安全规则,让只有管理员才能查看销售报表。”
每周 5 个新技能,1 分钟读完。
工作原理
它会分析你的应用如何处理登录和权限,并给出最合适的方案,帮你保护数据,同时控制每个用户能做什么。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Authentication & Authorization Implementation Patterns
Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.
Use this skill when
- Implementing user authentication systems
- Securing REST or GraphQL APIs
- Adding OAuth2/social login or SSO
- Designing session management or RBAC
- Debugging authentication or authorization issues
Do not use this skill when
- You only need UI copy or login page styling
- The task is infrastructure-only without identity concerns
- You cannot change auth policies or credential storage
Instructions
- Define users, tenants, flows, and threat model constraints.
- Choose auth strategy (session, JWT, OIDC) and token lifecycle.
- Design authorization model and policy enforcement points.
- Plan secrets storage, rotation, logging, and audit requirements.
- If detailed examples are required, open
resources/implementation-playbook.md.
Safety
- Never log secrets, tokens, or credentials.
- Enforce least privilege and secure storage for keys.
Resources
resources/implementation-playbook.mdfor detailed patterns and examples.
Worked example
Input: an Express application accepts a user's login and keeps the pre-login session ID. Read the bundled playbook, regenerate the session after credential verification, save only required identity fields, and verify that the old cookie cannot access /api/profile. Also test failed login, logout and store failure. Expected: successful login changes the session ID; failed login grants no access.
Inputs and prerequisites
Record the installed framework/SDK versions, identity provider, tenant model, credential store and test environment. Supply project-specific database adapters and request schemas; examples are integration sketches, not a runnable identity service.
Limitations
- JWT validation does not establish resource ownership; enforce tenant and object policy on reads and writes.
- Refresh rotation requires atomic persistence and concurrency tests; the issuance example alone does not provide it.
- Cookie flags do not replace CSRF protection, and secure-cookie behavior needs the actual HTTPS/proxy configuration tested.
- Provider integrations and password policies must be checked against current primary documentation and the application's threat model.
常见问题
“token”“会话(session)”和“资源访问边界”是什么意思?
这些都是应用的工作方式:会话或令牌用来记住你是谁,访问边界则规定你被允许做什么。
什么是 RBAC?
全称是 Role-Based Access Control,即基于角色的访问控制。不同类型的用户拥有不同的权限,例如管理员和普通用户。
什么是 OAuth2 或 SSO?
这两者都是更方便的登录方式:OAuth2 允许你用已有账号(比如 Google 账号)去访问其他应用;SSO(单点登录)则让你用一个账号登录多个应用。
详情
作者的原始描述
Implement or review authentication and authorization with explicit token, session and resource-access boundaries.
热度
- GitHub 星标
- 48k
- 排名
- #3841
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。