Skip to content

Conversation

@allisson
Copy link
Owner

@allisson allisson commented Jan 2, 2026

No description provided.

@allisson allisson requested a review from Copilot January 2, 2026 14:29
Copy link
Contributor

Copilot AI left a 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.

@allisson allisson requested a review from Copilot January 2, 2026 14:35
Copy link
Contributor

Copilot AI left a 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.

@allisson allisson merged commit 00f450d into main Jan 2, 2026
1 check passed
@allisson allisson deleted the add-auth-model-and-service branch January 2, 2026 14:47
allisson added a commit that referenced this pull request Jan 2, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants