- Documentation configuration OIDC, démarrage, diagnostic - Scripts batch pour démarrage backend et client - Script shell pour configuration Keycloak frontend
8.0 KiB
8.0 KiB
Instructions de Test - Lions User Manager
✅ Configuration Terminée
Tous les composants sont maintenant configurés et opérationnels !
🚀 Architecture Actuelle
┌─────────────────────────────────────────────┐
│ Navigateur Web │
└────────────┬────────────────────────────────┘
│
│ 1. http://localhost:8080
│ Redirection OIDC →
│
▼
┌─────────────────────────────────────────────┐
│ KEYCLOAK (Port 8180) ✅ │
│ - Realm: lions-user-manager │
│ - Client: lions-user-manager-client │
│ - Secret: client-secret-lions-2025 │
└────────────┬────────────────────────────────┘
│
│ 2. Authentification
│ testuser / test123
│
▼
┌─────────────────────────────────────────────┐
│ FRONTEND (Port 8080) ✅ │
│ - OIDC activé │
│ - Reçoit token JWT │
└────────────┬────────────────────────────────┘
│
│ 3. Appels API avec token JWT
│
▼
┌─────────────────────────────────────────────┐
│ BACKEND (Port 8081) ✅ │
│ - Vérifie le token JWT │
│ - Appelle Keycloak Admin API │
└─────────────────────────────────────────────┘
📋 Étapes de Test
1. Vérifier que tous les services tournent
# Backend (port 8081)
curl http://localhost:8081/q/health
# Keycloak (port 8180)
curl http://localhost:8180/realms/lions-user-manager
# Frontend (port 8080) - devrait rediriger
curl -I http://localhost:8080
2. Tester l'authentification complète
-
Ouvrir le navigateur : http://localhost:8080
-
Redirection automatique vers Keycloak :
- URL sera :
http://localhost:8180/realms/lions-user-manager/protocol/openid-connect/auth?...
- URL sera :
-
Se connecter avec les credentials :
- Username :
testuser - Password :
test123
- Username :
-
Redirection vers le frontend authentifié
-
Accéder aux pages protégées :
3. Tester les API Backend directement
Avec token (authentifié)
# 1. Obtenir un token
TOKEN=$(curl -s -X POST "http://localhost:8180/realms/lions-user-manager/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=lions-user-manager-client" \
-d "client_secret=client-secret-lions-2025" \
-d "username=testuser" \
-d "password=test123" \
-d "grant_type=password" | grep -o '"access_token":"[^"]*' | cut -d'"' -f4)
# 2. Appeler l'API avec le token
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:8081/api/users?realm=lions-user-manager"
🔑 Credentials
Keycloak Admin
- URL : http://localhost:8180/admin
- Username :
admin - Password :
admin - Realm :
master
Test User (Application)
- URL : http://localhost:8080
- Username :
testuser - Password :
test123 - Realm :
lions-user-manager
Client Configuration
- Client ID :
lions-user-manager-client - Client Secret :
client-secret-lions-2025 - Realm :
lions-user-manager
📊 Endpoints de Test
Frontend
- Accueil : http://localhost:8080
- Users List : http://localhost:8080/pages/user-manager/users/list.xhtml
- Roles List : http://localhost:8080/pages/user-manager/roles/list.xhtml
Backend API
- Swagger UI : http://localhost:8081/q/swagger-ui
- Dev UI : http://localhost:8081/q/dev
- Health : http://localhost:8081/q/health
- Keycloak Health : http://localhost:8081/api/health/keycloak
- Users API : http://localhost:8081/api/users?realm=lions-user-manager
- Roles API : http://localhost:8081/api/roles/realm?realm=lions-user-manager
Keycloak
- Admin Console : http://localhost:8180/admin
- Realm Info : http://localhost:8180/realms/lions-user-manager
- Well-known : http://localhost:8180/realms/lions-user-manager/.well-known/openid-configuration
⚠️ Troubleshooting
Frontend retourne "Forbidden"
- Cause : Pas authentifié
- Solution : Allez sur http://localhost:8080, laissez-vous rediriger vers Keycloak et authentifiez-vous
Erreur "Client not found"
- Cause : Configuration Keycloak incorrecte
- Solution : Vérifier que le client
lions-user-manager-clientexiste dans le realmlions-user-manager
Backend retourne 403
- Cause : Token invalide ou manquant
- Solution : S'assurer que le frontend envoie bien le token JWT dans l'en-tête
Authorization
"Invalid redirect_uri"
- Cause : Les redirect URIs ne sont pas configurées correctement
- Solution : Dans Keycloak Admin, vérifier que
http://localhost:8080/*est bien dans les Valid Redirect URIs
🧪 Scénarios de Test
Scénario 1 : Authentification et Liste des Utilisateurs
- Ouvrir http://localhost:8080
- Se connecter avec testuser/test123
- Naviguer vers la liste des utilisateurs
- Vérifier que les utilisateurs s'affichent
Scénario 2 : Créer un Utilisateur
- S'authentifier (voir Scénario 1)
- Cliquer sur "Nouveau Utilisateur"
- Remplir le formulaire
- Sauvegarder
- Vérifier que l'utilisateur apparaît dans la liste
Scénario 3 : Gestion des Rôles
- S'authentifier
- Aller sur la page des rôles
- Assigner des rôles à un utilisateur
- Vérifier que les rôles sont bien assignés
Scénario 4 : API Backend Directe
# Obtenir token
TOKEN=$(curl -s -X POST "http://localhost:8180/realms/lions-user-manager/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=lions-user-manager-client" \
-d "client_secret=client-secret-lions-2025" \
-d "username=testuser" \
-d "password=test123" \
-d "grant_type=password" | grep -o '"access_token":"[^"]*' | cut -d'"' -f4)
# Lister utilisateurs
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:8081/api/users?realm=lions-user-manager"
# Lister rôles
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:8081/api/roles/realm?realm=lions-user-manager"
✅ Checklist de Validation
- Backend démarre sur port 8081
- Keycloak accessible sur port 8180
- Frontend démarre sur port 8080
- Redirection OIDC fonctionne (frontend → Keycloak)
- Authentification réussie avec testuser/test123
- Pages protégées accessibles après authentification
- API Backend retourne des données
- Token JWT est correctement transmis
- Swagger UI accessible et fonctionnel
🎯 Prochaines Étapes (Post-Test)
- ✅ Validation de l'authentification complète
- ⏳ Tests fonctionnels de toutes les pages
- ⏳ Tests CRUD complets (Create, Read, Update, Delete)
- ⏳ Tests de gestion des rôles
- ⏳ Tests d'audit
- ⏳ Tests de synchronisation
📝 Notes
- Le frontend utilise maintenant OIDC avec Keycloak local
- Le backend vérifie les tokens JWT via OIDC
- Tous les appels API nécessitent un token valide
- Le test user
testusera les rôles :admin,user_manager
Date de configuration : 2025-12-05 Environnement : Développement (DEV)