From cae667b67f30528c444f1abd0de4eb0327c556bb Mon Sep 17 00:00:00 2001 From: "chris.ditcher" Date: Thu, 9 May 2024 14:09:00 -0700 Subject: [PATCH] Removed update client until we can fix the roles nightmare. --- tools/config/update-kc-client.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/config/update-kc-client.sh b/tools/config/update-kc-client.sh index f8c9f353..55e0796a 100644 --- a/tools/config/update-kc-client.sh +++ b/tools/config/update-kc-client.sh @@ -55,7 +55,7 @@ fetchClientUUID if [ "$CLIENT_UUID" = "" ] then # Client not found - echo "$CLIENT_ID DOES NOT EXIST IN KEYCLOAK! A new client with be created with a new access key. Creating..." + echo "$CLIENT_ID DOES NOT EXIST IN KEYCLOAK! A new client with be created with a new access key. MAKE SURE TO ADD GRAD_SYSTEM_COORDINATOR Role to new client! Creating..." # Retrieve json, remove secret field if exists (shouldn't) CLIENT_JSON=$(curl -s https://raw.githubusercontent.com/bcgov/$REPO_NAME/$BRANCH/tools/config/$CLIENT_ID.json | jq -c 'del(.secret)') # Create client @@ -74,18 +74,21 @@ else fetchClientCredentials # Ensure secret createClientSecret + ##### IMPORTANT + ## No longer removing old client until clients can be freed from roles + # Turf the old client - echo Removing existing client... - curl -sX DELETE "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients/$CLIENT_UUID" \ - -H "Authorization: Bearer $TKN" + #echo Removing existing client... + #curl -sX DELETE "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients/$CLIENT_UUID" \ + # -H "Authorization: Bearer $TKN" # Recreate the client wth updated info - echo Creating new client with credentials + #echo Creating new client with credentials # Get JSON and inject secret - CLIENT_JSON=$(curl -s https://raw.githubusercontent.com/bcgov/$REPO_NAME/$BRANCH/tools/config/$CLIENT_ID.json | jq -c --arg secret "$SERVICE_CLIENT_SECRET" '.secret = $secret') - curl -sX POST "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $TKN" \ - -d "$CLIENT_JSON" + #CLIENT_JSON=$(curl -s https://raw.githubusercontent.com/bcgov/$REPO_NAME/$BRANCH/tools/config/$CLIENT_ID.json | jq -c --arg secret "$SERVICE_CLIENT_SECRET" '.secret = $secret') + #curl -sX POST "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients" \ + # -H "Content-Type: application/json" \ + # -H "Authorization: Bearer $TKN" \ + # -d "$CLIENT_JSON" fi