auth-implementation-patterns
Implement Secure Authentication Systems
También disponible en: wshobson
Learn battle-tested authentication and authorization patterns to build secure access control in your applications without reinventing the wheel.
Descargar el ZIP de la skill
Subir en Claude
Ve a Configuración → Capacidades → Skills → Subir skill
Activa y empieza a usar
Pruébalo
Usando "auth-implementation-patterns". How do I implement JWT authentication in Express?
Resultado esperado:
A complete JWT implementation includes: 1) Generate tokens using jwt.sign() with secrets from environment variables, 2) Create authenticate middleware that verifies Bearer tokens, 3) Use short-lived access tokens (15min) with longer refresh tokens (7d), 4) Store refresh tokens hashed in database. See implementation-playbook.md Pattern 1 for full code.
Usando "auth-implementation-patterns". What's the difference between session and token-based auth?
Resultado esperado:
Session-based: Server stores state, session ID in cookie, simple but requires sticky sessions. Token-based (JWT): Stateless, self-contained claims, scales horizontally, but cannot revoke individual tokens easily. Choose sessions for traditional apps, JWT for APIs and microservices.
Usando "auth-implementation-patterns". How do I implement role-based authorization?
Resultado esperado:
Define roles in an enum (USER, MODERATOR, ADMIN), create a role hierarchy mapping, build requireRole() middleware that checks user role against allowed roles, apply middleware to protected routes. Example: app.delete('/users/:id', authenticate, requireRole('ADMIN'), handler)
Auditoría de seguridad
SeguroEducational documentation skill containing authentication and authorization code patterns. All 67 static findings are false positives: backticks are markdown code fences, environment variable access demonstrates proper secret handling, and weak crypto mentions are in cautionary context. No actual security risks present.
Puntuación de calidad
Lo que puedes crear
Build JWT authentication from scratch
Implement complete token-based auth with access tokens, refresh tokens, and proper secret management
Add OAuth2 social login
Integrate Google and GitHub OAuth2 authentication into existing applications
Design authorization model
Create RBAC or permission-based access control systems for application resources
Prueba estos prompts
Show me how to implement JWT authentication in Node.js with Express, including token generation and verification middleware
Create a refresh token flow that securely stores refresh tokens in a database and issues new access tokens
Implement Google OAuth2 login using Passport.js with JWT token generation after authentication
Design a role-based access control system with admin, moderator, and user roles, including middleware for permission checking
Mejores prácticas
- Always use environment variables for secrets (JWT_SECRET, SESSION_SECRET) never hardcode credentials
- Use short-lived access tokens (15-30 minutes) with separate refresh tokens for better security
- Store refresh tokens hashed in database and implement token rotation on use
Evitar
- Storing JWT in localStorage exposes tokens to XSS attacks - use httpOnly cookies instead
- Not validating token expiration allows expired tokens to be used indefinitely
- Client-side only authorization checks can be bypassed - always validate server-side
Preguntas frecuentes
When should I use session-based vs token-based authentication?
How do I securely store JWT secrets?
What's the difference between authentication and authorization?
How do I implement refresh tokens securely?
Can JWT tokens be revoked?
What's the best way to handle password storage?
Detalles del desarrollador
Autor
sickn33Licencia
MIT
Repositorio
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/auth-implementation-patternsRef.
main
Estructura de archivos