feat: OAuth 2.0 백엔드 시스템 구현 완료

Phase 1 & 2 완료:
- 프로젝트 기본 구조 설정
- Docker Compose 환경 구성 (MongoDB, Redis, Backend, Frontend)
- FastAPI 기반 OAuth 2.0 백엔드 구현

주요 기능:
- JWT 기반 인증 시스템
- 3단계 권한 체계 (System Admin/Group Admin/User)
- 사용자 관리 CRUD API
- 애플리케이션 관리 CRUD API
- OAuth 2.0 Authorization Code Flow
- Refresh Token 관리
- 인증 히스토리 추적

API 엔드포인트:
- /auth/* - 인증 관련 (register, login, logout, refresh)
- /users/* - 사용자 관리
- /applications/* - 애플리케이션 관리
- /oauth/* - OAuth 2.0 플로우

보안 기능:
- bcrypt 비밀번호 해싱
- JWT 토큰 인증
- CORS 설정
- Rate limiting 준비

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
jungwoo choi
2025-09-05 14:56:02 +09:00
parent abdcc31245
commit 6c21809a24
25 changed files with 2012 additions and 45 deletions

114
docker-compose.yml Normal file
View File

@ -0,0 +1,114 @@
version: '3.8'
services:
# MongoDB Database
mongodb:
image: mongo:7.0
container_name: oauth-mongodb
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
MONGO_INITDB_DATABASE: oauth_db
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
networks:
- oauth-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
start_period: 40s
# Redis Cache/Queue
redis:
image: redis:7-alpine
container_name: oauth-redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --appendonly yes
volumes:
- redis_data:/data
networks:
- oauth-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# OAuth Backend (FastAPI)
oauth-backend:
build:
context: ./oauth/backend
dockerfile: Dockerfile
target: development
container_name: oauth-backend
restart: unless-stopped
ports:
- "8000:8000"
environment:
- ENVIRONMENT=dev
- MONGODB_URL=mongodb://admin:admin123@mongodb:27017/oauth_db?authSource=admin
- REDIS_URL=redis://redis:6379
- SECRET_KEY=${SECRET_KEY:-3bf17c7f-5446-4a18-9cb3-f885eba501e8}
- DATABASE_NAME=oauth_db
volumes:
- ./oauth/backend:/app
- backend_logs:/var/log/oauth
networks:
- oauth-network
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# OAuth Frontend (React + Vite)
oauth-frontend:
build:
context: ./oauth/frontend
dockerfile: Dockerfile
target: development
container_name: oauth-frontend
restart: unless-stopped
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://localhost:8000/api/v1
- VITE_ENV=dev
volumes:
- ./oauth/frontend:/app
- /app/node_modules
networks:
- oauth-network
depends_on:
oauth-backend:
condition: service_started
command: npm run dev -- --host 0.0.0.0
networks:
oauth-network:
driver: bridge
name: oauth-network
volumes:
mongodb_data:
driver: local
name: oauth-mongodb-data
mongodb_config:
driver: local
name: oauth-mongodb-config
redis_data:
driver: local
name: oauth-redis-data
backend_logs:
driver: local
name: oauth-backend-logs