52 lines
2.3 KiB
PowerShell
52 lines
2.3 KiB
PowerShell
# Verification de la configuration du client Keycloak
|
|
$tokenResponse = Invoke-RestMethod -Uri "http://localhost:8180/realms/master/protocol/openid-connect/token" -Method POST -Body @{
|
|
client_id = "admin-cli"
|
|
grant_type = "password"
|
|
username = "admin"
|
|
password = "admin"
|
|
} -ContentType "application/x-www-form-urlencoded"
|
|
|
|
$headers = @{ Authorization = "Bearer $($tokenResponse.access_token)" }
|
|
|
|
$client = Invoke-RestMethod -Uri "http://localhost:8180/admin/realms/lions-user-manager/clients/b759720f-2a25-4118-9dc8-f167b79ad532" -Headers $headers
|
|
|
|
Write-Host "==================================================" -ForegroundColor Cyan
|
|
Write-Host "Configuration Client Keycloak - Verification" -ForegroundColor Cyan
|
|
Write-Host "==================================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Client ID: $($client.clientId)" -ForegroundColor White
|
|
Write-Host "Root URL: $($client.rootUrl)" -ForegroundColor White
|
|
Write-Host "Admin URL: $($client.adminUrl)" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "Redirect URIs:" -ForegroundColor White
|
|
$client.redirectUris | ForEach-Object { Write-Host " - $_" -ForegroundColor Gray }
|
|
Write-Host ""
|
|
Write-Host "Web Origins:" -ForegroundColor White
|
|
$client.webOrigins | ForEach-Object { Write-Host " - $_" -ForegroundColor Gray }
|
|
Write-Host ""
|
|
Write-Host "Standard Flow: $($client.standardFlowEnabled)" -ForegroundColor White
|
|
Write-Host "Direct Access Grants: $($client.directAccessGrantsEnabled)" -ForegroundColor White
|
|
Write-Host "Public Client: $($client.publicClient)" -ForegroundColor White
|
|
Write-Host "Client Secret: $($client.secret)" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "==================================================" -ForegroundColor Cyan
|
|
|
|
# Verification
|
|
$allGood = $true
|
|
if ($client.rootUrl -ne "http://localhost:8082") {
|
|
Write-Host "❌ Root URL incorrect: $($client.rootUrl)" -ForegroundColor Red
|
|
$allGood = $false
|
|
}
|
|
if ($client.webOrigins -contains "*") {
|
|
Write-Host "❌ Web Origins contient wildcard" -ForegroundColor Red
|
|
$allGood = $false
|
|
}
|
|
if ($client.redirectUris -contains "*") {
|
|
Write-Host "❌ Redirect URIs contient wildcard" -ForegroundColor Red
|
|
$allGood = $false
|
|
}
|
|
|
|
if ($allGood) {
|
|
Write-Host "✅ Configuration correcte!" -ForegroundColor Green
|
|
}
|