smart_ide/docs/features/sso-docv-enso.md
Nicolas Cantu 0af507143a Add smart-ide-global API layer, SSO delegates proxy, .logs access logs
- New smart-ide-global-api (127.0.0.1:37149): internal bearer, upstream proxy, X-OIDC forward
- SSO gateway calls global API with GLOBAL_API_INTERNAL_TOKEN; logs to .logs/sso-gateway/
- Aggregated config example, docs, VERSION 0.0.2, claw proxy local URL hint
2026-04-03 23:08:52 +02:00

60 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SSO — front plateforme et docv (filière Enso)
## Objectif
Permettre au **front web** de la plateforme `smart_ide` (déployé par environnement : test, pprod, prod) de déléguer lauthentification à **docv** via **OpenID Connect (OIDC)** , sans coupler le monorepo au code du dépôt Enso tant que celui-ci nest pas disponible sur la machine de documentation.
## Rôles
| Composant | Rôle |
|-----------|------|
| **Navigateur utilisateur** | Redirection vers docv (authorization endpoint) |
| **docv / IdP Enso** | Émet `id_token` / `access_token`, expose JWKS |
| **Front SPA** | Échange code OAuth (PKCE recommandé), stocke session |
| **Backend API** (orchestrateur ou BFF) | Valide JWT (signature JWKS, `iss`, `aud`, `exp`), mappe rôles → droits policy |
| **smart-ide-sso-gateway** (monorepo) | Point dentrée optionnel : validation JWT + proxy via **smart-ide-global-api** vers les micro-services avec jetons techniques — [sso-gateway-service.md](./sso-gateway-service.md) |
## Flux (authorization code + PKCE)
```mermaid
sequenceDiagram
participant Browser
participant Front as Front_SPA
participant Docv as docv_IdP
participant API as smart_ide_API
Browser->>Front: open app
Front->>Docv: redirect authorize
Docv->>Browser: login consent
Browser->>Front: callback code
Front->>Docv: token endpoint
Docv->>Front: access_token id_token
Front->>API: API calls Authorization Bearer
API->>API: validate JWT JWKS
```
Intégrations **IA** côté backend docv (services smart_ide, clones, AnythingLLM) : [docv-ai-integration.md](./docv-ai-integration.md).
Gestion documentaire, chemins **`../projects/<projet>/data`**, **`DOCV_PROJECTS_ROOT`** : [docv-service-integration.md](./docv-service-integration.md).
## Paramètres à fixer avec le dépôt Enso
- `issuer` (URL stable par env)
- `client_id` / `client_secret` ou client public + PKCE
- Scopes : au minimum `openid`, `profile`, `email` ; scopes métier docv si besoin
- **Audience** (`aud`) attendue par lAPI `smart_ide`
- Mapping **rôles / groupes** → profils OpenShell (lecture seule, deploy pprod, etc.)
## Environnements
Un **client OAuth par env** (test / pprod / prod) ou un seul client avec **claims** denvironnement — à trancher avec la sécurité Enso. Les URLs de callback du front diffèrent par déploiement.
## Références internes
- [sso-gateway-service.md](./sso-gateway-service.md) — passerelle OIDC → API internes
- [platform-target.md](../platform-target.md) — matrice test / pprod / prod
- [deployment-target.md](../deployment-target.md) — TLS, pas de HTTP de contournement
## Suite
Lorsque le dépôt Enso (ex. `/home/desk/code/enso/`) est accessible, compléter ce document avec les **chemins dendpoints** réels et captures décran des écrans docv concernés.