Files
unionflow-client-quarkus-pr…/setup-direct.sh
2025-09-19 16:09:21 +00:00

151 lines
5.2 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
echo "============================================================================="
echo "🚀 CONFIGURATION DIRECTE KEYCLOAK UNIONFLOW"
echo "============================================================================="
KEYCLOAK_URL="http://localhost:8180"
# Fonction pour créer le realm via l'interface web
create_realm_direct() {
echo "🏗️ Tentative de création du realm unionflow..."
# Essayons de créer le realm directement
curl -s -X POST \
"${KEYCLOAK_URL}/admin/realms" \
-H "Content-Type: application/json" \
-d '{
"realm": "unionflow",
"enabled": true,
"displayName": "UnionFlow",
"loginWithEmailAllowed": true,
"duplicateEmailsAllowed": false,
"resetPasswordAllowed": true,
"editUsernameAllowed": false,
"bruteForceProtected": false
}' > /dev/null 2>&1
echo "✅ Tentative de création du realm effectuée"
}
# Fonction pour tester l'authentification
test_auth() {
local username=$1
local password=$2
echo -n "Test ${username}... "
response=$(curl -s -X POST \
"${KEYCLOAK_URL}/realms/unionflow/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=${username}&password=${password}&grant_type=password&client_id=unionflow-mobile")
if echo "$response" | grep -q "access_token"; then
echo "✅ SUCCÈS"
return 0
else
echo "❌ ÉCHEC"
return 1
fi
}
# Fonction principale
main() {
echo "🔍 Vérification de la connexion à Keycloak..."
if ! curl -s "${KEYCLOAK_URL}" > /dev/null; then
echo "❌ Keycloak n'est pas accessible sur ${KEYCLOAK_URL}"
exit 1
fi
echo "✅ Keycloak accessible"
# Créer le realm
create_realm_direct
echo ""
echo "============================================================================="
echo "📋 INSTRUCTIONS MANUELLES"
echo "============================================================================="
echo ""
echo "🌐 Ouvrez votre navigateur sur: http://localhost:8180"
echo ""
echo "1⃣ PREMIÈRE CONNEXION :"
echo " • Cliquez sur 'Administration Console'"
echo " • Créez un compte admin si demandé"
echo " • Ou utilisez admin/admin123 si disponible"
echo ""
echo "2⃣ CRÉER LE REALM :"
echo " • Cliquez sur 'Create Realm'"
echo " • Nom: unionflow"
echo " • Cliquez 'Create'"
echo ""
echo "3⃣ CRÉER LE CLIENT :"
echo " • Allez dans Clients > Create client"
echo " • Client ID: unionflow-mobile"
echo " • Client type: OpenID Connect"
echo " • Cliquez 'Next' puis 'Save'"
echo " • Dans Settings: Public client = ON"
echo " • Direct access grants = ON"
echo " • Cliquez 'Save'"
echo ""
echo "4⃣ CRÉER LES RÔLES :"
echo " • Allez dans Realm roles > Create role"
echo " • Créez ces rôles :"
echo " - SUPER_ADMINISTRATEUR"
echo " - RESPONSABLE_TECHNIQUE"
echo " - RESPONSABLE_MEMBRES"
echo " - MEMBRE_ACTIF"
echo " - MEMBRE_SIMPLE"
echo ""
echo "5⃣ CRÉER LES UTILISATEURS :"
echo " • Allez dans Users > Add user"
echo " • Créez ces comptes :"
echo ""
echo " 👤 superadmin"
echo " Email: superadmin@unionflow.com"
echo " First name: Super, Last name: Admin"
echo " Mot de passe: SuperAdmin123!"
echo " Rôle: SUPER_ADMINISTRATEUR"
echo ""
echo " 👤 marie.active"
echo " Email: marie.active@unionflow.com"
echo " First name: Marie, Last name: Active"
echo " Mot de passe: Marie123!"
echo " Rôle: MEMBRE_ACTIF"
echo ""
echo " 👤 jean.simple"
echo " Email: jean.simple@unionflow.com"
echo " First name: Jean, Last name: Simple"
echo " Mot de passe: Jean123!"
echo " Rôle: MEMBRE_SIMPLE"
echo ""
echo " 👤 tech.lead"
echo " Email: tech.lead@unionflow.com"
echo " First name: Tech, Last name: Lead"
echo " Mot de passe: TechLead123!"
echo " Rôle: RESPONSABLE_TECHNIQUE"
echo ""
echo " 👤 rh.manager"
echo " Email: rh.manager@unionflow.com"
echo " First name: RH, Last name: Manager"
echo " Mot de passe: RhManager123!"
echo " Rôle: RESPONSABLE_MEMBRES"
echo ""
echo "6⃣ POUR CHAQUE UTILISATEUR :"
echo " • Après création, allez dans l'onglet 'Credentials'"
echo " • Cliquez 'Set password'"
echo " • Entrez le mot de passe, décochez 'Temporary'"
echo " • Allez dans 'Role mapping'"
echo " • Cliquez 'Assign role' et sélectionnez le bon rôle"
echo ""
echo "7⃣ TESTER :"
echo " • Une fois terminé, exécutez: ./verify-final.sh"
echo ""
echo "============================================================================="
echo "🎯 APRÈS CONFIGURATION MANUELLE, TOUS LES COMPTES FONCTIONNERONT !"
echo "============================================================================="
}
main