マニュアル
https://www.keycloak.org/docs-api/12.0/rest-api/index.html
curl --insecure http://keycloak:8080/auth/realms/s1/.well-known/openid-configuration | jq
export token=$(curl --insecure \
-d "client_id=admin-cli" \
-d "username=admin" \
-d "password=xxxxx" \
-d "grant_type=password" \
http://keycloak:8080/auth/realms/master/protocol/openid-connect/token | jq -r '.access_token')
echo $token
curl --insecure -X POST \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json; charset=UTF-8"
-d '{"username":"hogehoge", "enabled": true, "email": "[email protected]"}' \
http://keycloak:8080/auth/admin/realms/s1/users -v
curl --insecure -X GET \
-H "Authorization: Bearer $token" \
http://keycloak:8080/auth/admin/realms/s1/users?username=hogehoge | jq
export userid=$(curl --insecure -X GET \
-H "Authorization: Bearer $token" \
http://keycloak:8080/auth/admin/realms/s1/users?username=hogehoge | jq -r .[].id)
echo $userid
curl --insecure -X PUT \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{"type": "password", "value": "hogefuga", "temporary": true}' \
http://keycloak:8080/auth/admin/realms/s1/users/${userid}/reset-password -v
curl --insecure -X DELETE \
-H "Authorization: Bearer $token" \
http://keycloak:8080/auth/admin/realms/s1/users/${userid} -v