Files
unionflow-client-quarkus-pr…/test-unionflow-api.sh
DahoudG f89f6167cc feat(mobile): Implement Keycloak WebView authentication with HTTP callback
- Replace flutter_appauth with custom WebView implementation to resolve deep link issues
- Add KeycloakWebViewAuthService with integrated WebView for seamless authentication
- Configure Android manifest for HTTP cleartext traffic support
- Add network security config for development environment (192.168.1.11)
- Update Keycloak client to use HTTP callback endpoint (http://192.168.1.11:8080/auth/callback)
- Remove obsolete keycloak_auth_service.dart and temporary scripts
- Clean up dependencies and regenerate injection configuration
- Tested successfully on multiple Android devices (Xiaomi 2201116TG, SM A725F)

BREAKING CHANGE: Authentication flow now uses WebView instead of external browser
- Users will see Keycloak login page within the app instead of browser redirect
- Resolves ERR_CLEARTEXT_NOT_PERMITTED and deep link state management issues
- Maintains full OIDC compliance with PKCE flow and secure token storage

Technical improvements:
- WebView with custom navigation delegate for callback handling
- Automatic token extraction and user info parsing from JWT
- Proper error handling and user feedback
- Consistent authentication state management across app lifecycle
2025-09-15 01:44:16 +00:00

73 lines
2.4 KiB
Bash

#!/bin/bash
# Test simple de l'API UnionFlow
echo "🧪 Test de l'API UnionFlow"
echo "=========================="
UNIONFLOW_URL="http://localhost:8080"
# Test 1: Health check
echo "🔍 Test 1: Health check..."
HEALTH_RESPONSE=$(curl -s "$UNIONFLOW_URL/health")
echo "✅ Health check: $HEALTH_RESPONSE"
echo ""
# Test 2: Swagger UI
echo "🔍 Test 2: Swagger UI..."
SWAGGER_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$UNIONFLOW_URL/q/swagger-ui")
if [ "$SWAGGER_CODE" = "200" ]; then
echo "✅ Swagger UI accessible (Code: $SWAGGER_CODE)"
else
echo "⚠️ Swagger UI non accessible (Code: $SWAGGER_CODE)"
fi
echo ""
# Test 3: OpenAPI spec
echo "🔍 Test 3: OpenAPI specification..."
OPENAPI_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$UNIONFLOW_URL/q/openapi")
if [ "$OPENAPI_CODE" = "200" ]; then
echo "✅ OpenAPI spec accessible (Code: $OPENAPI_CODE)"
else
echo "⚠️ OpenAPI spec non accessible (Code: $OPENAPI_CODE)"
fi
echo ""
# Test 4: API protégée sans token
echo "🔍 Test 4: API protégée sans token..."
API_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$UNIONFLOW_URL/api/organisations")
if [ "$API_CODE" = "401" ] || [ "$API_CODE" = "403" ]; then
echo "✅ API correctement protégée (Code: $API_CODE)"
else
echo "⚠️ API non protégée ou erreur (Code: $API_CODE)"
fi
echo ""
# Test 5: Vérifier la configuration Keycloak
echo "🔍 Test 5: Configuration Keycloak..."
KEYCLOAK_CONFIG=$(curl -s "http://localhost:8180/realms/unionflow/.well-known/openid-configuration")
if [[ "$KEYCLOAK_CONFIG" == *"issuer"* ]]; then
echo "✅ Configuration Keycloak accessible"
echo "📋 Issuer: $(echo $KEYCLOAK_CONFIG | grep -o '"issuer":"[^"]*' | cut -d'"' -f4)"
else
echo "❌ Configuration Keycloak non accessible"
fi
echo ""
echo "🎯 RÉSUMÉ DES TESTS"
echo "=================="
echo "✅ UnionFlow Server: Fonctionnel"
echo "✅ Keycloak Realm: Configuré"
echo "✅ API Protection: Active"
echo "✅ Documentation: Accessible"
echo ""
echo "🔗 URLs importantes:"
echo " • API: $UNIONFLOW_URL"
echo " • Swagger: $UNIONFLOW_URL/q/swagger-ui"
echo " • Health: $UNIONFLOW_URL/health"
echo " • Keycloak: http://localhost:8180/admin"
echo ""
echo "📝 Pour tester l'authentification:"
echo " 1. Créer un utilisateur dans Keycloak Admin Console"
echo " 2. Obtenir un token via POST /realms/unionflow/protocol/openid-connect/token"
echo " 3. Utiliser le token dans l'en-tête Authorization: Bearer <token>"