Initial commit: unionflow-mobile-apps

Application Flutter complète (sans build artifacts).

Signed-off-by: lions dev Team
This commit is contained in:
dahoud
2026-03-15 16:30:08 +00:00
commit d094d6db9c
1790 changed files with 507435 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
# Keycloak lire les rôles et la config UnionFlow (curl)
Base URL Keycloak : **http://localhost:8180**
Identifiants admin : **username=admin**, **password=admin**.
## 1. Obtenir un token admin (realm master)
```bash
curl -s -X POST "http://localhost:8180/realms/master/protocol/openid-connect/token" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
-d "username=admin" ^
-d "password=admin" ^
-d "grant_type=password" ^
-d "client_id=admin-cli"
```
Sous Linux/macOS, remplacer `^` par `\`.
Réponse attendue : JSON avec `access_token`, `expires_in`, etc.
Copier la valeur de `access_token` pour les appels suivants (ou parser avec `jq` : `... | jq -r .access_token`).
## 2. Lister les rôles du realm **unionflow**
Remplacez `ACCESS_TOKEN` par le token obtenu à létape 1.
```bash
curl -s -H "Authorization: Bearer ACCESS_TOKEN" ^
"http://localhost:8180/admin/realms/unionflow/roles"
```
Rôles typiques côté UnionFlow : `ADMIN`, `ADMIN_ORGANISATION`, `MEMBRE`, `MODERATEUR`, etc.
## 3. Récupérer la configuration du realm **unionflow**
```bash
curl -s -H "Authorization: Bearer ACCESS_TOKEN" ^
"http://localhost:8180/admin/realms/unionflow"
```
Contient la config générale du realm (nom, login, thème, tokens, etc.).
## 4. Rôles par client (ex. application UnionFlow)
Si les rôles sont définis sur un client (client scope), lister les rôles du client :
```bash
# Récupérer lid du client (ex. unionflow-mobile ou account)
curl -s -H "Authorization: Bearer ACCESS_TOKEN" ^
"http://localhost:8180/admin/realms/unionflow/clients?clientId=unionflow-mobile"
# Puis lister les rôles du client (remplacer CLIENT_UUID par lid du client)
curl -s -H "Authorization: Bearer ACCESS_TOKEN" ^
"http://localhost:8180/admin/realms/unionflow/clients/CLIENT_UUID/roles"
```
## 5. Exemple PowerShell (token + rôles en une fois)
```powershell
$body = @{
username = 'admin'
password = 'admin'
grant_type = 'password'
client_id = 'admin-cli'
}
$tokenResponse = Invoke-RestMethod -Uri 'http://localhost:8180/realms/master/protocol/openid-connect/token' -Method Post -Body $body -ContentType 'application/x-www-form-urlencoded'
$token = $tokenResponse.access_token
# Rôles du realm unionflow
Invoke-RestMethod -Uri 'http://localhost:8180/admin/realms/unionflow/roles' -Headers @{ Authorization = "Bearer $token" }
# Config du realm unionflow
Invoke-RestMethod -Uri 'http://localhost:8180/admin/realms/unionflow' -Headers @{ Authorization = "Bearer $token" }
```
## Note
LAPI Admin Keycloak (`/admin/realms/...`) exige un utilisateur du realm **master** (admin). Les rôles visibles dans le JWT des utilisateurs connectés à lapp (realm **unionflow**) viennent du realm **unionflow** (realm roles ou client roles selon la config).