Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main merge ( 20230814 ) #243

Merged
merged 8 commits into from
Aug 16, 2023
5 changes: 4 additions & 1 deletion deploy_apps/tks-remove-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,19 @@ spec:
JSON_DATA=$(curl -s -k GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" ${keycloak_url}/auth/admin/realms/${organization_id}/clients\?\clientId\=grafana)
# Convert the array to a JSON array
num_redirect_uris=$(echo $JSON_DATA | jq '.[0].redirectUris | length')
last_redirect_uri=$(echo $JSON_DATA | jq -r '.[0].redirectUris[-1]')
if [ $num_redirect_uris -gt 1 ]
then
# Remove endpoint from client redirectUris
MODIFIED_JSON=$(echo $JSON_DATA | jq --arg value "http://$endpoint/*" '.[0] | { "redirectUris": (.redirectUris | map(select(. != $value))) }' )
# Write the JSON array to a new file
echo "$MODIFIED_JSON" > modified_data.json
curl -s -k -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" -d @modified_data.json ${keycloak_url}/auth/admin/realms/${organization_id}/clients/${client_uuid}
else
elif [ $num_redirect_uris -eq 1 ] && [ "$last_redirect_uri" == "http://$endpoint/*" ]; then
# Remove client
curl -s -k -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" ${keycloak_url}/auth/admin/realms/${organization_id}/clients/${client_uuid}
else
echo "no redirect uri to remove"
fi
fi
envFrom:
Expand Down