L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Design et création · SKILL.md

auth-design

auth-design

Design authentication and authorization systems — OAuth/OIDC, RBAC/ABAC, session management, token strategies, SSO, and multi-tenancy. TRIGGER when: user says /auth-design, needs to design an auth system, or asks about authentication, authorization, or identity management.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: auth-design description: > Design authentication and authorization systems — OAuth/OIDC, RBAC/ABAC, session management, token strategies, SSO, and multi-tenancy. TRIGGER when: user says /auth-design, needs to design an auth system, or asks about authentication, authorization, or identity management. argument-hint: "[application or system requiring auth design]" user-invocable: true

Authentication & Authorization Design

You are a security-focused engineer. Design auth systems that are secure, usable, and maintainable.

Process

Step 1: Assess Requirements

DimensionQuestions
UsersInternal employees, external customers, API consumers, machines?
ScaleHow many users? Concurrent sessions?
Identity sourceOwn database, SSO/IdP, social login, federation?
Multi-tenancySingle tenant, multi-tenant, tenant isolation model?
ComplianceSOC2, HIPAA, PCI-DSS, GDPR requirements?
MFARequired for all? Risk-based? Which factors?
Session durationMinutes (banking) to weeks (consumer app)?

Step 2: Design Authentication

MethodUse CaseSecurity Level
Password + MFAStandard user loginMedium-High
SSO (SAML/OIDC)Enterprise customersHigh
Social login (OAuth)Consumer appsMedium
API keysMachine-to-machine, simple integrationsMedium
OAuth 2.0 + PKCESPAs, mobile appsHigh
Client credentialsService-to-serviceHigh
Passwordless (magic link/WebAuthn)Modern consumer appsHigh

Token strategy:

TokenPurposeStorageLifetime
Access tokenAPI authorizationMemory (never localStorage)15-60 minutes
Refresh tokenObtain new access tokensHttpOnly secure cookieDays-weeks
ID tokenUser identity claimsMemorySame as access token
Session tokenServer-side sessionHttpOnly secure cookieHours-days

Step 3: Design Authorization

ModelDescriptionBest For
RBACUsers assigned roles, roles have permissionsMost applications
ABACPolicies based on user/resource/context attributesComplex, dynamic rules
ReBACPermissions based on relationships between entitiesSocial, collaborative apps
ACLPer-resource access control listsFile systems, simple sharing

RBAC design template:

RolePermissionsScope
AdminFull CRUD on all resourcesOrganization
ManagerCRUD on team resources, read on orgTeam
MemberCRUD on own resources, read on teamSelf + team
ViewerRead-onlyAssigned resources

Step 4: Handle Multi-Tenancy

PatternIsolationComplexityCost
Separate databasesHighestHighHigh
Shared database, separate schemasHighMediumMedium
Shared database, tenant columnMediumLowLow
Row-level securityMedium-HighMediumLow

Step 5: Secure the Implementation

ConcernMitigation
Brute forceRate limiting, account lockout, CAPTCHA
Session hijackingSecure/HttpOnly/SameSite cookies, token rotation
Token theftShort-lived access tokens, refresh token rotation
Privilege escalationServer-side permission checks on every request
CSRFSameSite cookies, CSRF tokens for forms
Credential storagebcrypt/scrypt/argon2 with salt, never plaintext
LoggingLog auth events (login, failure, permission denied)

Step 6: Plan Migration (if applicable)

PhaseActivities
Dual-writeWrite to old and new auth systems
Shadow modeNew system runs but old system decides
Gradual cutoverMigrate users in batches
CleanupRemove old auth system

Output Format

## Auth Design: [System]

### Authentication
- Method: [chosen approach]
- Token strategy: [table]
- Session management: [approach]

### Authorization
- Model: [RBAC/ABAC/ReBAC]
- Roles and permissions: [table]

### Security Controls
- [Mitigation list]

### Multi-Tenancy
- Pattern: [chosen approach]
- Isolation: [level]

Quality Checklist

  • Authentication method matches user types
  • Tokens are short-lived with secure storage
  • Authorization checked server-side on every request
  • MFA supported (at minimum for admin roles)
  • Credential storage uses strong hashing
  • Rate limiting protects against brute force
  • Auth events are logged for audit trail
  • Session invalidation is possible (logout, compromise)

Edge Cases

  • For B2B SaaS, plan for customer-managed SSO (SAML/OIDC) early
  • For APIs consumed by third parties, use OAuth 2.0 with scoped tokens
  • If migrating auth systems, plan for a long dual-running period
  • For microservices, decide between gateway auth vs per-service auth
  • For mobile, use PKCE flow and secure enclave for token storage
Skills enregistrées