Complete implementation of the production line incident response system (生產線異常即時反應系統) including: Backend (FastAPI): - User authentication with AD integration and session management - Chat room management (create, list, update, members, roles) - Real-time messaging via WebSocket (typing indicators, reactions) - File storage with MinIO (upload, download, image preview) Frontend (React + Vite): - Authentication flow with token management - Room list with filtering, search, and pagination - Real-time chat interface with WebSocket - File upload with drag-and-drop and image preview - Member management and room settings - Breadcrumb navigation - 53 unit tests (Vitest) Specifications: - authentication: AD auth, sessions, JWT tokens - chat-room: rooms, members, templates - realtime-messaging: WebSocket, messages, reactions - file-storage: MinIO integration, file management - frontend-core: React SPA structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
816 B
Python
22 lines
816 B
Python
"""Authentication module - Reusable authentication system with AD API integration
|
|
|
|
This module provides:
|
|
- Dual-token session management (internal + AD tokens)
|
|
- Automatic AD token refresh with retry limit (max 3 attempts)
|
|
- 3-day inactivity timeout
|
|
- Encrypted password storage for auto-refresh
|
|
- FastAPI dependency injection for protected routes
|
|
|
|
Usage in other modules:
|
|
from app.modules.auth import get_current_user
|
|
|
|
@router.get("/protected-endpoint")
|
|
async def my_endpoint(current_user: dict = Depends(get_current_user)):
|
|
# current_user contains: {"username": "...", "display_name": "..."}
|
|
return {"user": current_user["display_name"]}
|
|
"""
|
|
from app.modules.auth.router import router
|
|
from app.modules.auth.dependencies import get_current_user
|
|
|
|
__all__ = ["router", "get_current_user"]
|