{ "schema_version": 1, "diagram_type": "sequence", "meta": { "title": "ThothII — login OIDC e richieste autenticate", "locale": "it", "output": "docs/architecture/thothii-auth-oidc.html", "quality_profile": "showcase", "repository": { "url": "https://git.tylconsulting.it/mptyl/ThothII.git", "link_mode": "local-only", "revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3" } }, "participants": [ { "id": "browser", "type": "frontend", "label": "Browser", "sublabel": "frontend React", "sources": [ { "path": "frontend/src/api/auth.ts", "line": 71, "end_line": 105, "label": "config e beginOidcLogin" } ] }, { "id": "backend", "type": "backend", "label": "Backend", "sublabel": "route /auth", "sources": [ { "path": "backend/src/auth/routes.ts", "line": 247, "end_line": 286, "label": "GET /auth/oidc/login" }, { "path": "backend/src/auth/routes.ts", "line": 288, "end_line": 349, "label": "GET /auth/oidc/callback" }, { "path": "backend/src/auth/auth.ts", "line": 76, "end_line": 110, "label": "authenticateSession" } ] }, { "id": "store", "type": "database", "label": "Auth state", "sublabel": "file, volume auth-state", "sources": [ { "path": "backend/src/auth/session-store.ts", "line": 389, "end_line": 395, "label": "createFileAuthSessionStore" }, { "path": "compose.yaml", "line": 30, "end_line": 30 } ] }, { "id": "idp", "type": "security", "label": "Identity provider", "sublabel": "OIDC", "sources": [ { "path": "backend/src/auth/oidc-client.ts", "line": 24, "end_line": 27, "label": "OidcProtocol" } ] } ], "segments": [ { "from": 160, "to": 342, "label": "Avvio login" }, { "from": 352, "to": 444, "label": "Provider" }, { "from": 454, "to": 738, "label": "Callback" }, { "from": 748, "to": 870, "label": "Richieste" } ], "messages": [ { "from": "browser", "to": "backend", "y": 170, "label": "GET /auth/config" }, { "from": "backend", "to": "browser", "y": 200, "label": "mode: oidc", "variant": "return" }, { "from": "browser", "to": "backend", "y": 230, "label": "GET /auth/oidc/login", "variant": "emphasis" }, { "from": "backend", "to": "store", "y": 260, "label": "createOidcState", "note": "nonce e code verifier PKCE" }, { "from": "backend", "to": "browser", "y": 326, "label": "302 verso il provider", "variant": "return" }, { "from": "browser", "to": "idp", "y": 362, "label": "authorize + PKCE", "variant": "security", "note": "login sul provider" }, { "from": "idp", "to": "browser", "y": 428, "label": "302 callback con code", "variant": "return" }, { "from": "browser", "to": "backend", "y": 464, "label": "GET /auth/oidc/callback", "variant": "emphasis" }, { "from": "backend", "to": "store", "y": 494, "label": "consumeOidcState", "note": "verifica transazione, revisione e issuer" }, { "from": "backend", "to": "idp", "y": 560, "label": "scambio code", "variant": "security", "note": "firma, audience, scadenza, nonce" }, { "from": "idp", "to": "backend", "y": 626, "label": "identità + gruppi", "variant": "return" }, { "from": "backend", "to": "store", "y": 656, "label": "crea sessione", "note": "ruoli dai gruppi, TTL limitato al token" }, { "from": "backend", "to": "browser", "y": 722, "label": "cookie + redirect /", "variant": "return" }, { "from": "browser", "to": "backend", "y": 758, "label": "API con cookie", "variant": "emphasis" }, { "from": "backend", "to": "store", "y": 788, "label": "resolve + touch", "note": "sessione revocata se cambia la config" }, { "from": "backend", "to": "browser", "y": 854, "label": "risposta", "variant": "return" } ], "cards": [ { "dot": "cyan", "title": "Tre modalità", "items": [ "local: utenti con hash Argon2id in users.yaml", "oidc: questo flusso (Authorization Code + PKCE)", "upstream: il proxy del portale (Omics) passa l'identità negli header; niente login né cookie ThothII" ] }, { "dot": "rose", "title": "Autorizzazione", "items": [ "I gruppi OIDC sono mappati esattamente sui ruoli user e admin", "I permessi si ricalcolano dai ruoli a ogni richiesta", "Le richieste che modificano dati richiedono origine esatta e token CSRF" ] } ] }