🐛 Add custom exception handlers and enhance OpenAPI security in AuthX#873
Merged
Conversation
- Implemented methods to set request exception handlers for various AuthX exceptions, ensuring proper error responses. - Added a method to ensure default exception handlers are installed for active requests, preventing 500 responses for auth errors. - Included specific handlers for exceptions like MissingCSRFTokenError, LoginTypeMismatchError, and RateLimitExceeded, among others.
- Introduced new methods for handling OpenAPI security dependencies, including support for header, cookie, and query token locations. - Added descriptions for JWT usage in OpenAPI documentation to improve clarity for users. - Refactored token validation dependencies in `AuthX` and `AuthManager` to utilize the new security schemes, ensuring a more flexible and robust authentication process.
- Introduced a new test suite for OpenAPI security features, validating the integration of access token requirements and error handling. - Implemented tests to ensure proper OpenAPI metadata is generated for various token locations (headers, cookies, query). - Enhanced error handling tests for revoked, missing, and invalid tokens, ensuring consistent responses across different scenarios.
- Added `uvicorn` version `0.39.0` to the dependencies. - Updated `anyio` from `4.7.0` to `4.12.1` and added a new version `4.14.0` with updated resolution markers. - Introduced `httpx2` version `2.0.0` to the test dependencies. - Adjusted Python version resolution markers for compatibility.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #873 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 20
Lines 1370 1457 +87
Branches 168 173 +5
=========================================
+ Hits 1370 1457 +87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ndler - Implemented tests to verify the functionality of request exception handlers for MissingTokenError and RateLimitExceeded. - Ensured that existing handlers are preserved when setting new handlers. - Added checks for requests without starlette scope to confirm proper behavior. - Enhanced OpenAPI security metadata tests to include custom header token locations.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #872