-
Notifications
You must be signed in to change notification settings - Fork 9
Feat: Added audience override if contains Project ID #674
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements automatic audience detection for JWT validation when the token's audience claim matches the project ID. This allows tokens with project ID audiences to be validated without explicitly passing the audience parameter.
Key changes:
- Added logic to auto-detect and use project ID as audience when token contains matching audience claim
- Supports both single string and list audience formats in tokens
- Added comprehensive test coverage for the new auto-detection behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| descope/auth.py | Added audience auto-detection logic in _validate_token method that decodes token without audience verification first, checks if audience matches project ID, and uses it for final validation |
| tests/test_auth.py | Added 6 new test cases covering auto-detection scenarios: string audience, list audience, no match, explicit audience override, validate_and_refresh_session, and mismatch failure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)descope/auth.py
|
Related Issues
Fixes https://github.com/descope/etc/issues/12464
Related PRs
Description
A few sentences describing the overall goals of the pull request's commits.
Must