-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Phase 2: Authentication Service with JWT and FastAPI Integration #11
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
…ervice integration Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…rove documentation Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
|
@copilot |
…ting Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
... Fixed in commit fe5b447. The email validator now accepts special-use domains like The validator works by:
You can now use |
|
@copilot When I call the |
… database Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Fixed in commit 5dffaeb. The system user created during migration was incorrectly set as an admin ( Changed the system user to The |
|
@copilot There doesn't seem to be any endpoint for creating non-admin users. Is this coming in Phase 3? |
Correct - Phase 2 focuses on the core authentication infrastructure (login, logout, token validation) and initial admin setup. User management endpoints (creating/updating/deleting users, managing invitations) are not explicitly detailed in the implementation plan but would typically be added in a subsequent phase. The database schema already includes a Admin-only user management endpoints:
Self-service endpoints:
These would logically fit after Phase 3 (when authentication is required on endpoints) and before Phase 5 (frontend development). The |
lstein
left a comment
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.
Tested endpoints and working as advertised.
Code reviewed.
Summary
Implements Phase 2 of the multiuser feature per
docs/multiuser/implementation_plan.md. Adds JWT-based authentication layer on top of Phase 1's database schema and auth utilities.New Components:
auth_dependencies.py): FastAPI dependency functions for JWT token validation and admin enforcementrouters/auth.py): REST endpoints for login, logout, user info, and initial admin setupInvocationServicesandApiDependencies.local,.test,localhost) for testing/development while maintaining validation for production domainsAPI Endpoints:
Usage Example:
Security:
Email Validation:
The implementation includes a custom email validator (
validate_email_with_special_domains()) that:.local,.test, andlocalhostfor testing/development@example.com)Bug Fixes:
.local,.test,localhost) for testingis_admin = FALSE), allowing/auth/setupto work on fresh databases. The system user is only for backward compatibility with pre-existing data.SECRET_KEYintoken_service.pyis hardcoded for development. Move to secure configuration before production deployment.Related Issues / Discussions
Implements Phase 2 of multiuser implementation plan as specified in
docs/multiuser/implementation_plan.mdQA Instructions
Quick Test:
Start server with in-memory DB:
Create initial admin (now works with
.localdomains and fresh databases):Login to get token:
Use token for authenticated requests:
curl -X GET http://localhost:9090/api/v1/auth/me \ -H "Authorization: Bearer <token>"Expected Behavior:
admin@test.localMerge Plan
No special considerations. Database migration runs automatically on startup. The system user fix ensures fresh installations can create their first admin user properly.
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.