-
Notifications
You must be signed in to change notification settings - Fork 45
feat!: refactor swagger API authentication #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Updated security definitions in Swagger and Go files to replace BearerAuth with JwtAuth. - Simplified API key and JWT authentication across various controllers and middleware. - Removed unauthorized response handling from API documentation. - Enhanced API key management documentation for clarity. - Updated frontend SDK to reflect changes in API key and JWT authentication methods.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 18.61% 19.90% +1.29%
==========================================
Files 181 181
Lines 18826 18829 +3
==========================================
+ Hits 3504 3748 +244
+ Misses 15161 14897 -264
- Partials 161 184 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… headers - Changed log level from Warn to Debug for missing authentication headers in AllAuth method to reduce log noise. - Minor formatting adjustment in the code for improved readability.
- Updated log level from Info to Debug for API key and JWT authentication routing to reduce log verbosity. - Changed log level from Debug to Warn for missing authentication headers to highlight critical issues more effectively.
- Updated error messages in the ValidateKey method to use lowercase "invalid API key" for consistency.
- Changed the context parameter in the ValidateKey method call from the gin context to the request context for improved consistency and reliability in API key validation.
…ware - Introduced unit tests for the API key service, covering key creation, validation, expiration handling, and usage limits. - Added middleware tests to ensure proper authentication flow and error handling for missing or invalid API keys. - Implemented a mock service for testing middleware interactions, enhancing test coverage and reliability.
- Introduced a new integration test suite for the API key service, covering key creation, validation, expiration handling, and usage limits. - Implemented tests for middleware interactions with real HTTP requests to ensure proper authentication flow. - Enhanced test coverage by validating key usage count updates and handling of expired keys.
|
I added some fixes, unit tests and gave integration tests a stab. Please let me know if I should revert something. |
|
LGTM! |
* feat: refactor swagger API authentication - Updated security definitions in Swagger and Go files to replace BearerAuth with JwtAuth. - Simplified API key and JWT authentication across various controllers and middleware. - Removed unauthorized response handling from API documentation. - Enhanced API key management documentation for clarity. - Updated frontend SDK to reflect changes in API key and JWT authentication methods. * refactor(auth_chain): update logging level for missing authentication headers - Changed log level from Warn to Debug for missing authentication headers in AllAuth method to reduce log noise. - Minor formatting adjustment in the code for improved readability. * refactor(auth_chain): change logging levels for authentication routing - Updated log level from Info to Debug for API key and JWT authentication routing to reduce log verbosity. - Changed log level from Debug to Warn for missing authentication headers to highlight critical issues more effectively. * fix(api_key): standardize error messages for invalid API keys - Updated error messages in the ValidateKey method to use lowercase "invalid API key" for consistency. * fix(api_key): update context usage in API key validation - Changed the context parameter in the ValidateKey method call from the gin context to the request context for improved consistency and reliability in API key validation. * feat(api_key): add comprehensive tests for API key service and middleware - Introduced unit tests for the API key service, covering key creation, validation, expiration handling, and usage limits. - Added middleware tests to ensure proper authentication flow and error handling for missing or invalid API keys. - Implemented a mock service for testing middleware interactions, enhancing test coverage and reliability. * feat(api_key): add integration tests for API key service functionality - Introduced a new integration test suite for the API key service, covering key creation, validation, expiration handling, and usage limits. - Implemented tests for middleware interactions with real HTTP requests to ensure proper authentication flow. - Enhanced test coverage by validating key usage count updates and handling of expired keys.
Warning
Attention: Breaking change with the API Key !
Change header from
Authorization: pk_...toX-API-Key: pk_...Resolves #208