Skip to content

Instantly share code, notes, and snippets.

@strongant
Last active December 25, 2023 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strongant/d8084edcb8efa5e64e8365e4e125b460 to your computer and use it in GitHub Desktop.
Save strongant/d8084edcb8efa5e64e8365e4e125b460 to your computer and use it in GitHub Desktop.
batch remove clients by curl
#!/bin/bash
clients="xxx
xxx1"
realm='xxx'
token='xxxxx'
# 设置 IFS 为换行符
IFS=$'\n'
# 遍历字符串集合
for str in $clients; do
echo $str
curl "http://localhost:8080/auth/admin/realms/${realm}/clients/$str" \
-X 'DELETE' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en,zh-CN;q=0.9,zh;q=0.8,lb;q=0.7,gd;q=0.6' \
-H "Authorization: bearer $token" \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: Idea-8a7e2fe7=472ad10a-e9ed-4403-976e-1886aabdd31a; XXL_JOB_LOGIN_IDENTITY=7b226964223a312c22757365726e616d65223a2261646d696e222c2270617373776f7264223a226531306164633339343962613539616262653536653035376632306638383365222c22726f6c65223a312c227065726d697373696f6e223a6e756c6c7d; _ga=GA1.1.547721401.1693880759; _ga_GDWQY4XZV0=GS1.1.1695382169.36.0.1695382169.0.0.0; Hm_lvt_86c67d891e2b7fa3f077e18cf34b9435=1696662913; _ga_17YKFWX30S=GS1.1.1696662915.1.1.1696665545.0.0.0; JSESSIONID=942B2230AD078B87075B936D09D5D6AD' \
-H 'Origin: http://localhost:8080' \
-H 'Pragma: no-cache' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'x-gray: yes' \
--data-raw '{}' \
--compressed > /dev/null &
done
wait;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment