Add API key authentication alongside JWT#5169
Conversation
wndzph9jkb-create
left a comment
There was a problem hiding this comment.
Code review:
1. Out of scope changes — PR modifies which is not in scope for issue #177. The acceptance criteria only requires changes to auth middleware.
2. Non-existent model imports — References and from but these models do not exist in the project. This will cause import errors.
3. RateLimitConfig API mismatch — Uses and params that do not exist in the RateLimitConfig constructor. Will cause runtime errors.
4. JWT algorithm vulnerability not fixed — Original code uses allowing token forgery. This PR does not address this documented security bug.
5. Python syntax issues — Missing newline at end of main.py, inconsistent import paths between relative and absolute imports.
|
Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request within 2 hours. Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. |
Summary
Adds static API key authentication support alongside the existing JWT-based auth middleware.
Changes
New Features
X-API-Keyheader as alternative auth method alongside JWTPOST /auth/api-keys: Generate new API keys (returns plaintext key exactly once)DELETE /auth/api-keys/{id}: Revoke API keysGET /auth/api-keys: List all API keys for authenticated userFixes
Tests
21 comprehensive tests covering:
Closes #177