From fcf32d8043bf2a0453e7c4d476495042cc350319 Mon Sep 17 00:00:00 2001
From: Nicolas Pernoud <npernoud@grandlyon.com>
Date: Mon, 7 Jun 2021 11:20:01 +0200
Subject: [PATCH] doc: Liste des cas d'usages

---
 usecases.md | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 161 insertions(+)
 create mode 100644 usecases.md

diff --git a/usecases.md b/usecases.md
new file mode 100644
index 0000000..eb23215
--- /dev/null
+++ b/usecases.md
@@ -0,0 +1,161 @@
+# Cas d'usages GLC Pro (par ordre d'implémentation)
+
+## Cas d'usage 0 : Mock d'un serveur OIDC (base du proxy France Connect)
+
+```plantuml
+@startuml
+title Cas d'usage 0 : Mock d'un serveur OIDC
+actor u as "Utilisateur"
+participant app as "Application"
+participant glc as "GLC Pro"
+
+
+u -> app : 1. Demande de connection avec GLC Pro
+app --> u : 2. HTTP 302 : Redirection sur l'URL "Authorization Code Request" avec les paramètres :\n scope="profile <color:red>openid</color>"&redirect_uri=[client_callback]&client_id=[client_id]&response_type=code&state=foobar
+u -> glc : 3. Requête sur l'URL d'autorisation avec les paramètres listés ci dessus.
+glc --> u : 4. Demande de consentement d'accès au profil "<color:red>openid</color> pour l'application [Application] ?
+u -> glc : 5. Consentement
+glc --> u : 6. HTTP 302 : Redirection sur [client_callback] avec les paramètres: code=[authorization_code]&state=foobar
+u -> app : 7. Requête sur [client_callback] URL avec les paramètres listés ci dessus.
+app -> glc : 8. Appel de l'URL <color:red>"ID Token Request"</color> avec les paramètres :\n code=[authorization_code]&client_id=[client_id]&client_secret=[client_secret]&grant_type=authorization_code
+glc --> app : 9. HTTP 200 avec [<color:red>id_token</color>]
+@enduml
+```
+
+## Cas d'usage 1 : Authentification d'un dirigeant d'entreprise
+
+```plantuml
+@startuml
+title Cas d'usage 1 : Accès à une démarche depuis un portail de service public pour un dirigeant
+actor u as "Chef d'entreprise"
+participant app as "Application"
+participant glc as "GLC Pro"
+participant fc as "France Connect"
+participant siren as "API Entreprise"
+== Exercice du statut de dirigeant d'entreprise ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+glc --> u : Page de demande du numéro SIREN
+u -> glc : Saisie du numéro SIREN
+glc --> siren : Interrogation API
+siren --> glc : Récupération de l'entreprise si validation du dirigeant
+glc --> glc : Enrichissement du jeton FC avec l'entreprise
+glc --> app : Transmission du jeton enrichi (flux OIDC non détaillé)
+app --> u : Ouverture de la démarche
+@enduml
+```
+
+## Cas d'usage 2 : Mandatement d'un dirigeant d'établissement
+
+```plantuml
+@startuml
+title Cas d'usage 2 : Demande d'habilitation par un dirigeant
+actor u as "Chef d'établissement"
+actor d as "Chef d'entreprise"
+participant app as "Application"
+participant glc as "GLC Pro"
+participant fc as "France Connect"
+participant siren as "API Entreprise"
+== Authentification du demandeur et demande d'habilitation ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+u -> glc : Formulaire de demande avec numéro SIREN
+glc --> siren : Requête d'identification du dirigeant
+siren --> glc : Identité du dirigeant
+== Validation par le dirigeant ==
+glc --> d : Notification par mail au dirigeant (sur mail présent dans API Entreprise)
+d -> glc : Validation de l'habilitation (authentification France Connect préalable)
+glc --> u : Information de l'activation de l'habilitation
+== Exercice de l'habilitation ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+glc --> u : Page de demande du numéro SIREN
+u -> glc : Saisie du numéro SIREN
+glc --> glc : Interrogation base des habilitations
+glc --> glc : Enrichissement du jeton FC avec l'entreprise
+glc --> app : Transmission du jeton enrichi (flux OIDC non détaillé)
+app --> u : Ouverture de la démarche
+@enduml
+```
+
+## Cas d'usage 3 : Mandatement en cascade d'un tiers
+
+```plantuml
+@startuml
+title Cas d'usage 3 : Mandatement en cascade
+actor u as "Demandeur"
+actor de as "Chef d'établissement"
+actor d as "Chef d'entreprise"
+participant app as "Application"
+participant glc as "GLC Pro"
+participant fc as "France Connect"
+participant siren as "API Entreprise"
+== Authentification du chef d'établissement et demande de mandat ==
+de -> glc : Demande de mandat
+glc --> fc : Redirection France Connect
+de -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+de -> glc : Formulaire de demande avec numéro SIREN
+glc --> siren : Requête d'identification du dirigeant
+siren --> glc : Identité du dirigeant
+== Validation par le dirigeant ==
+glc --> d : Notification par mail au dirigeant (sur mail présent dans API Entreprise)
+d -> glc : Validation de l'habilitation <color:red>en cascade</color> (authentification France Connect préalable)
+glc --> de : Information de l'activation de l'habilitation
+
+== Authentification du demandeur et demande d'habilitation ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+u -> glc : Formulaire de demande avec numéro SIRET
+glc --> glc : Identification du dirigeant d'établissement
+== Validation par le dirigeant d'établissement ==
+glc --> de : Notification par mail au dirigeant d'établissement (sur mail présent dans GLC Pro)
+de -> glc : Validation de l'habilitation (authentification France Connect préalable)
+glc --> u : Information de l'activation de l'habilitation
+== Exercice de l'habilitation ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+glc --> u : Page de demande du numéro SIRET
+u -> glc : Saisie du numéro SIRET
+glc --> glc : Interrogation base des habilitations
+glc --> glc : Enrichissement du jeton FC avec l'entreprise
+glc --> app : Transmission du jeton enrichi (flux OIDC non détaillé)
+app --> u : Ouverture de la démarche
+@enduml
+```
+
+## Cas d'usage 4 : Gestion et révocation des mandats
+
+```plantuml
+@startuml
+title Cas d'usage 4 : Gestion et révocation des mandats
+actor u as "Chef d'entreprise"
+participant app as "Application"
+participant glc as "GLC Pro"
+participant fc as "France Connect"
+== Connexion ==
+u -> app : Demande d'accès
+app --> glc : Redirection
+glc --> fc : Redirection France Connect
+u -> fc : Authentification
+fc --> glc : Renvoi du jeton d'identité (flux OIDC non détaillé)
+glc --> u : Page listant les mandats donnés (directement et en cascade)
+u -> glc : Suppression d'un mandat
+glc --> glc : Suppression de tous les mandats en cascade liés (?)
+@enduml
+```
-- 
GitLab