Master authentication and authorization patterns including
Authentication & Authorization Implementation Patterns

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
--- name: auth-implementation-patterns description: Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues. --- # Authentication & Authorization Implementation Patterns Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices. ## When to Use This Skill - Implementing user authentication systems - Securing REST or GraphQL APIs - Adding OAuth2/social login - Implementing role-based access control (RBAC) - Designing session management - Migrating authentication systems - Debugging auth issues
Overview
Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.
Manual install (npx, ZIP)
npx skills add wshobson/agents --skill auth-implementation-patterns -g -a claude-codemkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \
| tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/developer-essentials/skills/auth-implementation-patternsNew-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/807f5f8eaf1535e57b6b/auth-implementation-patterns.zip" -OutFile "$env:TEMP\auth-implementation-patterns.zip"; Expand-Archive "$env:TEMP\auth-implementation-patterns.zip" -DestinationPath "$HOME\.claude\skills" -ForceConnects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md2.6 KBreferences/1 file · 13.4 KB
Read the files here
Show the full text84 lines
Authentication & Authorization Implementation Patterns
Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.
When to Use This Skill
- Implementing user authentication systems
- Securing REST or GraphQL APIs
- Adding OAuth2/social login
- Implementing role-based access control (RBAC)
- Designing session management
- Migrating authentication systems
- Debugging auth issues
- Implementing SSO or multi-tenancy
Core Concepts
1. Authentication vs Authorization
Authentication (AuthN): Who are you?
- Verifying identity (username/password, OAuth, biometrics)
- Issuing credentials (sessions, tokens)
- Managing login/logout
Authorization (AuthZ): What can you do?
- Permission checking
- Role-based access control (RBAC)
- Resource ownership validation
- Policy enforcement
2. Authentication Strategies
Session-Based:
- Server stores session state
- Session ID in cookie
- Traditional, simple, stateful
Token-Based (JWT):
- Stateless, self-contained
- Scales horizontally
- Can store claims
OAuth2/OpenID Connect:
- Delegate authentication
- Social login (Google, GitHub)
- Enterprise SSO
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
- Never Store Plain Passwords: Always hash with bcrypt/argon2
- Use HTTPS: Encrypt data in transit
- Short-Lived Access Tokens: 15-30 minutes max
- Secure Cookies: httpOnly, secure, sameSite flags
- Validate All Input: Email format, password strength
- Rate Limit Auth Endpoints: Prevent brute force attacks
- Implement CSRF Protection: For session-based auth
- Rotate Secrets Regularly: JWT secrets, session secrets
- Log Security Events: Login attempts, failed auth
- Use MFA When Possible: Extra security layer
Common Pitfalls
- Weak Passwords: Enforce strong password policies
- JWT in localStorage: Vulnerable to XSS, use httpOnly cookies
- No Token Expiration: Tokens should expire
- Client-Side Auth Checks Only: Always validate server-side
- Insecure Password Reset: Use secure tokens with expiration
- No Rate Limiting: Vulnerable to brute force
- Trusting Client Data: Always validate on server
| 1 | |
| 2 | name auth-implementation-patterns |
| 3 | description Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues. |
| 4 | |
| 5 | |
| 6 | # Authentication & Authorization Implementation Patterns |
| 7 | |
| 8 | Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | Implementing user authentication systems |
| 13 | Securing REST or GraphQL APIs |
| 14 | Adding OAuth2/social login |
| 15 | Implementing role-based access control (RBAC) |
| 16 | Designing session management |
| 17 | Migrating authentication systems |
| 18 | Debugging auth issues |
| 19 | Implementing SSO or multi-tenancy |
| 20 | |
| 21 | ## Core Concepts |
| 22 | |
| 23 | ### 1. Authentication vs Authorization |
| 24 | |
| 25 | **Authentication (AuthN)**: Who are you? |
| 26 | |
| 27 | Verifying identity (username/password, OAuth, biometrics) |
| 28 | Issuing credentials (sessions, tokens) |
| 29 | Managing login/logout |
| 30 | |
| 31 | **Authorization (AuthZ)**: What can you do? |
| 32 | |
| 33 | Permission checking |
| 34 | Role-based access control (RBAC) |
| 35 | Resource ownership validation |
| 36 | Policy enforcement |
| 37 | |
| 38 | ### 2. Authentication Strategies |
| 39 | |
| 40 | **Session-Based:** |
| 41 | |
| 42 | Server stores session state |
| 43 | Session ID in cookie |
| 44 | Traditional, simple, stateful |
| 45 | |
| 46 | **Token-Based (JWT):** |
| 47 | |
| 48 | Stateless, self-contained |
| 49 | Scales horizontally |
| 50 | Can store claims |
| 51 | |
| 52 | **OAuth2/OpenID Connect:** |
| 53 | |
| 54 | Delegate authentication |
| 55 | Social login (Google, GitHub) |
| 56 | Enterprise SSO |
| 57 | |
| 58 | ## Detailed patterns and worked examples |
| 59 | |
| 60 | Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. |
| 61 | |
| 62 | ## Best Practices |
| 63 | |
| 64 | **Never Store Plain Passwords**: Always hash with bcrypt/argon2 |
| 65 | **Use HTTPS**: Encrypt data in transit |
| 66 | **Short-Lived Access Tokens**: 15-30 minutes max |
| 67 | **Secure Cookies**: httpOnly, secure, sameSite flags |
| 68 | **Validate All Input**: Email format, password strength |
| 69 | **Rate Limit Auth Endpoints**: Prevent brute force attacks |
| 70 | **Implement CSRF Protection**: For session-based auth |
| 71 | **Rotate Secrets Regularly**: JWT secrets, session secrets |
| 72 | **Log Security Events**: Login attempts, failed auth |
| 73 | **Use MFA When Possible**: Extra security layer |
| 74 | |
| 75 | ## Common Pitfalls |
| 76 | |
| 77 | **Weak Passwords**: Enforce strong password policies |
| 78 | **JWT in localStorage**: Vulnerable to XSS, use httpOnly cookies |
| 79 | **No Token Expiration**: Tokens should expire |
| 80 | **Client-Side Auth Checks Only**: Always validate server-side |
| 81 | **Insecure Password Reset**: Use secure tokens with expiration |
| 82 | **No Rate Limiting**: Vulnerable to brute force |
| 83 | **Trusting Client Data**: Always validate on server |
| 84 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
SkillGuides stable API and interface design
MCPPulls up-to-date, version-specific library docsContext7
SkillFetch up-to-date documentation and code examples for anyContext7 Documentation Lookup
SkillHow to use the Adaptyv Bio Foundry API and Python SDK
SkillMaster C/.NET backend development patterns for building
SkillGuides the usage of Gemini Interactions API on GeminiGemini Interactions API SkillMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillMigrate from AngularJS to Angular using hybrid modeAngular migration
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns