Complete OAuth-based authentication with JWT session management:
Core Services:
- JWT service for access/refresh token creation and verification
- Token store with Redis-backed refresh token revocation
- User service for CRUD operations and OAuth-based creation
- Google and Discord OAuth services with full flow support
API Endpoints:
- GET /api/auth/{google,discord} - Start OAuth flows
- GET /api/auth/{google,discord}/callback - Handle OAuth callbacks
- POST /api/auth/refresh - Exchange refresh token for new access token
- POST /api/auth/logout - Revoke single refresh token
- POST /api/auth/logout-all - Revoke all user sessions
- GET/PATCH /api/users/me - User profile management
- GET /api/users/me/linked-accounts - List OAuth providers
- GET /api/users/me/sessions - Count active sessions
Infrastructure:
- Pydantic schemas for auth/user request/response models
- FastAPI dependencies (get_current_user, get_current_premium_user)
- OAuthLinkedAccount model for multi-provider support
- Alembic migration for oauth_linked_accounts table
Dependencies added: email-validator, fakeredis (dev), respx (dev)
84 new tests, 1058 total passing
62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
# Docker Compose for Mantimon TCG local development
|
|
#
|
|
# Usage:
|
|
# docker-compose up -d # Start services in background
|
|
# docker-compose down # Stop services
|
|
# docker-compose logs -f # Follow logs
|
|
# docker-compose ps # Check status
|
|
#
|
|
# Services:
|
|
# - PostgreSQL 15 (port 5433 -> 5432)
|
|
# - Redis 7 (port 6380 -> 6379)
|
|
#
|
|
# Note: Non-standard host ports to avoid conflicts with other projects
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: mantimon-postgres
|
|
environment:
|
|
POSTGRES_USER: mantimon
|
|
POSTGRES_PASSWORD: mantimon
|
|
POSTGRES_DB: mantimon
|
|
ports:
|
|
- "5433:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mantimon -d mantimon"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: mantimon-redis
|
|
command: redis-server --appendonly no --maxmemory 100mb --maxmemory-policy allkeys-lru
|
|
ports:
|
|
- "6380:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
adminer:
|
|
image: adminer:latest
|
|
restart: unless-stopped
|
|
container_name: mantimon-adminer
|
|
ports:
|
|
- "8090:8080"
|
|
environment:
|
|
- ADMINER_DEFAULT_SERVER=mantimon-postgres
|
|
- TZ=America/Chicago
|
|
depends_on:
|
|
- postgres
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: mantimon_postgres_data
|