Implement Phase 4 auth routes: password login/logout, WebAuthn registration and authentication, magic link registration, and credential management pages with HTMX. Includes session middleware, Jinja2 templates, vendored HTMX, and last-credential guardrails. 120 tests passing.
39 lines
810 B
Python
39 lines
810 B
Python
# src/fastapi_oidc_op/config.py
|
|
from enum import StrEnum
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class StorageBackend(StrEnum):
|
|
SQLITE = "sqlite"
|
|
MONGODB = "mongodb"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = {"env_prefix": "OIDC_OP_"}
|
|
|
|
# Core
|
|
issuer: str
|
|
debug: bool = False
|
|
|
|
# Storage
|
|
storage_backend: StorageBackend = StorageBackend.SQLITE
|
|
|
|
# SQLite
|
|
sqlite_path: str = "data/oidc_op.db"
|
|
|
|
# MongoDB
|
|
mongodb_uri: str = "mongodb://localhost:27017"
|
|
mongodb_database: str = "oidc_op"
|
|
|
|
# Management RP
|
|
manage_client_id: str = "manage-app"
|
|
|
|
# Session
|
|
session_secret: str | None = None # If None, a random secret is generated per process
|
|
|
|
# Magic links
|
|
invite_ttl: int = 86400 # seconds
|
|
|
|
# Theme
|
|
theme: str = "default"
|