-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add authentication support #24
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 adds authentication support to the fastpubsub system, introducing OAuth2-based client authentication with JWT tokens and scope-based authorization for API endpoints.
Key Changes:
- Implements client management with CRUD operations for authentication clients
- Adds JWT token generation and validation with scope-based permissions
- Integrates authorization checks across all topic and subscription API endpoints
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_models.py | Tests for client model scope validation |
| tests/services/test_clients.py | Comprehensive client service tests including token operations |
| tests/services/test_auth.py | Tests for scope checking and authorization |
| tests/helpers.py | Renamed helper function for clarity |
| tests/conftest.py | Added Client model to test cleanup |
| tests/api/routers/test_topics.py | Updated to use renamed helper function |
| tests/api/routers/test_subscriptions.py | Updated to use renamed helper function |
| tests/api/routers/test_clients.py | API tests for client endpoints |
| pyproject.toml | Added authentication dependencies |
| migrations/versions/002_3818df3592a5_new_migration.py | Database migration for clients table |
| fastpubsub/services/topics.py | Added type hint for delete_topic parameter |
| fastpubsub/services/helpers.py | Enhanced entity helpers to support UUID types |
| fastpubsub/services/clients.py | Core client management and JWT token services |
| fastpubsub/services/auth.py | Authorization logic with scope validation |
| fastpubsub/services/init.py | Exported new client and auth services |
| fastpubsub/models.py | Added client-related models and unified error model |
| fastpubsub/main.py | Added CLI commands for client management |
| fastpubsub/exceptions.py | Added authentication exception types |
| fastpubsub/database.py | Added Client database model |
| fastpubsub/config.py | Added authentication configuration |
| fastpubsub/api/routers/topics.py | Integrated authorization for topic endpoints |
| fastpubsub/api/routers/subscriptions.py | Integrated authorization for subscription endpoints |
| fastpubsub/api/routers/monitoring.py | Updated error response model |
| fastpubsub/api/routers/clients.py | New router for client management endpoints |
| fastpubsub/api/app.py | Registered client router and exception handlers |
| env.sample | Added authentication environment variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
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
Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
* Initial plan * Add comprehensive authentication documentation to README - Add authentication configuration section with all auth-related environment variables - Add Docker commands section for generate_secret_key and create_client - Add Authentication section to API Reference explaining scopes and OAuth flow - Add Clients API documentation with all CRUD endpoints - Add Example 1 showing how to set up authentication - Add Example 3 showing how to create clients with different scopes - Add Security best practices section - Add Authentication Issues troubleshooting section - Renumber all examples to maintain consistency Co-authored-by: allisson <[email protected]> * Fix formatting: add backticks to token_version in security section Co-authored-by: allisson <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: allisson <[email protected]>
No description provided.