Skip to content

Commit

Permalink
Update update-kc.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaDeveloper456788 authored Dec 9, 2024
1 parent 4bd0c69 commit 64ae91b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Keycloak/update-kc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ do
--data-raw "$line")
echo -e " Response : $result\n"
default_scopes=$(echo "$line" | jq -r '.defaultClientScopes[]')
clientId=$(echo "$line" | jq -r '.clientId')
CLIENT_UUID=$(curl -sX GET "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TKN" \
| jq '.[] | select(.clientId=="'"$CLIENT_ID"'")' | jq -r '.id')

echo "$default_scopes" | while read -r scope; do
echo "$clientId"
echo "$CLIENT_UUID"
echo "$scope"
#PUT /{realm}/clients/{id}/default-client-scopes/{clientScopeId}
result=$(curl -s -v -w "%{http_code}" -X PUT "$KC_BASE_URL/$KC_REALM_ID/clients/$clientId/default-client-scopes/$scope" \
result=$(curl -s -v -w "%{http_code}" -X PUT "$KC_BASE_URL/$KC_REALM_ID/clients/$CLIENT_UUID/default-client-scopes/$scope" \
--header "Authorization: Bearer $TKN" \
--header "Content-Type: application/json" \
)
Expand Down

0 comments on commit 64ae91b

Please sign in to comment.