Skip to content

🐛 Add custom exception handlers and enhance OpenAPI security in AuthX#873

Merged
yezz123 merged 5 commits into
mainfrom
fix-component
Jun 24, 2026
Merged

🐛 Add custom exception handlers and enhance OpenAPI security in AuthX#873
yezz123 merged 5 commits into
mainfrom
fix-component

Conversation

@yezz123

@yezz123 yezz123 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Fixes #872

yezz123 added 4 commits June 24, 2026 14:17
- 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.
@yezz123 yezz123 self-assigned this Jun 24, 2026
@yezz123 yezz123 added the bug Something isn't working label Jun 24, 2026
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
authx Ready Ready Preview, Comment Jun 24, 2026 1:24pm

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c5626c6) to head (b870fa9).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…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.
@yezz123 yezz123 merged commit 2aa70ab into main Jun 24, 2026
21 checks passed
@yezz123 yezz123 deleted the fix-component branch June 24, 2026 13:26
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Authorization button in Swagger/OpenAPI

1 participant