Overview
Learnille implements a multi-tiered security model utilizing JSON Web Tokens (JWT) for stateless session authentication and CASL / NestJS Guards for granular Role-Based Access Control (RBAC).🔐 1. Authentication & Token Architecture
Key Security Properties
- Access Token Expiry: 15 minutes.
- Refresh Token Rotation: Refresh tokens are single-use; issuing a new access token invalidates the previous refresh token in Redis.
- Payload Sanitization: JWT payloads contain non-sensitive identifiers only (
userId,email,role,permissions).
🛡 2. Role Hierarchy & Permission Matrix
🔒 3. NestJS Guard Implementation Standard
All protected controllers must includeJwtAuthGuard and @ApiBearerAuth():