Skip to content

Conversation

@yezz123
Copy link
Owner

@yezz123 yezz123 commented Jan 4, 2026

Fixes: #577

  • Added InsufficientScopeError exception to handle cases where tokens lack required scopes.
  • Introduced scopes_required() dependency for FastAPI to enforce scope validation on routes.
  • Enhanced TokenPayload with has_scopes() method to check for required scopes, supporting AND/OR logic and wildcard matching.
  • Created utility functions for scope management, including match_scope() and has_required_scopes().
  • Updated documentation with a new section on scope management, including examples for creating tokens with scopes and protecting routes.
  • Added tests for scope management functionality, ensuring robust coverage for new features.

- Added `InsufficientScopeError` exception to handle cases where tokens lack required scopes.
- Introduced `scopes_required()` dependency for FastAPI to enforce scope validation on routes.
- Enhanced `TokenPayload` with `has_scopes()` method to check for required scopes, supporting AND/OR logic and wildcard matching.
- Created utility functions for scope management, including `match_scope()` and `has_required_scopes()`.
- Updated documentation with a new section on scope management, including examples for creating tokens with scopes and protecting routes.
- Added tests for scope management functionality, ensuring robust coverage for new features.
@vercel
Copy link

vercel bot commented Jan 4, 2026

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

Project Deployment Review Updated (UTC)
authx Ready Ready Preview, Comment Jan 4, 2026 5:43pm

- Updated `InsufficientScopeError` to utilize `Optional` for `provided` and `message` parameters, enhancing type safety.
- Modified `has_required_scopes` function to accept `Optional[Sequence[str]]` for `provided` parameter, improving flexibility in scope validation.
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.88%. Comparing base (6c288f6) to head (d182639).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #788      +/-   ##
==========================================
+ Coverage   96.69%   96.88%   +0.19%     
==========================================
  Files          15       16       +1     
  Lines         786      834      +48     
  Branches       79       87       +8     
==========================================
+ Hits          760      808      +48     
  Misses         20       20              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 4, 2026

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@yezz123 yezz123 added the breaking Breaking Changes label Jan 4, 2026
@yezz123 yezz123 merged commit bffad26 into main Jan 4, 2026
21 checks passed
@yezz123 yezz123 deleted the Scope-Management branch January 4, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking Changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope Management

2 participants