Replace the demo user authentication with API key system for internal service access and resource protection. User-based auth is not required for this internal service.
Tasks
1. API Key Model & Database
2. Authentication Middleware
3. Management Endpoints
These endpoints are not formalized yet. The list below should serve as a basis for planning endpoints.
4. Router Updates
5. Configuration & Migration
Acceptance Criteria
Security Requirements
Dependencies
- Database connection implementation (separate ticket)
- Error handling improvements (separate ticket)
- Logging for authentication events (separate ticket)
Notes
- Consider key rotation capability (separate ticket)
- Consider key usage analytics (separate ticket)
- Rate limiting will be implemented in a separate ticket
Unknowns
- should associate API key with org? - Given that the
User will the primary tenant object for Fluent, we should definitely associate keys to users. However, we will also need the functionality to associate keys to an org as well. This can be done by Polymorphic Association with a Nullable-Constrained Check
- Standardize API key request format - todo. Needs discussion.
Replace the demo user authentication with API key system for internal service access and resource protection. User-based auth is not required for this internal service.
Tasks
1. API Key Model & Database
ApiKeymodel with fields: key_hash, name, permissions, is_active, created_at, expires_at - (this might need a discussion about expiration policy)2. Authentication Middleware
X-API-Keyheader orapi_keyquery parameter - prefer header<limiting id>to request state for downstream use<limiting id>3. Management Endpoints
These endpoints are not formalized yet. The list below should serve as a basis for planning endpoints.
POST /admin/api-keys- Generate new API keyGET /admin/api-keys- List API keys (admin only)PUT /admin/api-keys/{id}- Update API keyDELETE /admin/api-keys/{id}- Revoke API keyGET /api-keys/me- Current key info (for key holders)4. Router Updates
5. Configuration & Migration
Acceptance Criteria
Security Requirements
Dependencies
Notes
Unknowns
Userwill the primary tenant object for Fluent, we should definitely associate keys to users. However, we will also need the functionality to associate keys to an org as well. This can be done by Polymorphic Association with a Nullable-Constrained Check