Geutebruck API Developer
|
fbebe10711
|
Phase 4: Authentication System (T039-T048)
Implemented complete JWT-based authentication system with RBAC:
**Tests (TDD Approach):**
- Created contract tests for /api/v1/auth/login endpoint
- Created contract tests for /api/v1/auth/logout endpoint
- Created unit tests for AuthService (login, logout, validate_token, password hashing)
- Created pytest configuration and fixtures (test DB, test users, tokens)
**Schemas:**
- LoginRequest: username/password validation
- TokenResponse: access_token, refresh_token, user info
- LogoutResponse: logout confirmation
- RefreshTokenRequest: token refresh payload
- UserInfo: user data (excludes password_hash)
**Services:**
- AuthService: login(), logout(), validate_token(), hash_password(), verify_password()
- Integrated bcrypt password hashing
- JWT token generation (access + refresh tokens)
- Token blacklisting in Redis
- Audit logging for all auth operations
**Middleware:**
- Authentication middleware with JWT validation
- Role-based access control (RBAC) helpers
- require_role() dependency factory
- Convenience dependencies: require_viewer(), require_operator(), require_administrator()
- Client IP and User-Agent extraction
**Router:**
- POST /api/v1/auth/login - Authenticate and get tokens
- POST /api/v1/auth/logout - Blacklist token
- POST /api/v1/auth/refresh - Refresh access token
- GET /api/v1/auth/me - Get current user info
**Integration:**
- Registered auth router in main.py
- Updated startup event to initialize Redis and SDK Bridge clients
- Updated shutdown event to cleanup connections properly
- Fixed error translation utilities
- Added asyncpg dependency for PostgreSQL async driver
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-09 09:04:16 +01:00 |
|
Geutebruck API Developer
|
733b3b924a
|
Phase 1 Complete: Project Setup & Configuration
Completed Tasks (T001-T010):
- ✅ Project structure created (src/, tests/, docs/, scripts/)
- ✅ Python dependencies defined (requirements.txt)
- ✅ C# SDK Bridge project initialized (.csproj)
- ✅ Configuration template (.env.example)
- ✅ Database migration config (alembic.ini)
- ✅ Code quality tools (pyproject.toml with ruff, black, mypy)
- ✅ Development setup script (setup_dev_environment.ps1)
- ✅ Service startup script (start_services.ps1)
- ✅ Architecture documentation (docs/architecture.md)
- ✅ Revised MVP tasks (tasks-revised-mvp.md - 84 tasks focused on cross-switching)
MVP Scope Refined:
- Focus: Cross-switching control for GSCView viewers
- NO recordings, NO analytics, NO LPR in MVP
- REST API only, no UI needed
- Phase 2: GeViSet configuration management
Ready for Phase 2: SDK Bridge Foundation
🤖 Generated with Claude Code (https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-09 08:25:26 +01:00 |
|