This document provides an overview of the security mechanisms implemented in the Rod Royale Backend.
- JWT-based authentication using access and refresh tokens.
- Passwords are securely hashed with bcrypt via Passlib.
- Token validation and user lookup are performed for each request.
- SECRET_KEY is required for JWT signing. If not set, a temporary key is generated (not recommended for production).
- Sensitive configuration is loaded from environment variables.
- MongoDB indexes are created for performance and uniqueness (e.g., email, username).
- User IDs are validated as ObjectId before database queries.
- JWT and database errors are logged and return appropriate HTTP status codes.
- Invalid or expired tokens result in 401 Unauthorized responses.
- TODO
For production, I'll ensure all secrets are set and use a secure deployment strategy.