mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 23:03:41 +00:00
Add complete authentication layer: - Pydantic v2 schemas for auth requests/responses and user representation - Auth service with login (account locking, MFA), registration (invitation tokens + domain whitelist), token management, MFA setup/activation, and password change - FastAPI router with 8 endpoints: login, register, refresh, logout, mfa/setup, mfa/verify, change-password, me - Router registered in main.py under /api/auth Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
603 B
Python
26 lines
603 B
Python
# backend/app/main.py
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.auth import router as auth_router
|
|
from app.config import get_settings
|
|
|
|
settings = get_settings()
|
|
|
|
app = FastAPI(title=settings.APP_NAME, docs_url="/docs")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.CORS_ORIGINS.split(","),
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# --- Routers ---
|
|
app.include_router(auth_router, prefix="/api/auth", tags=["auth"])
|
|
|
|
|
|
@app.get("/api/health")
|
|
def health_check():
|
|
return {"status": "ok"}
|