Untitled
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
#!/bin/bash login_access=$(curl -k -X POST \ -H "Content-Type:application/x-www-form-urlencoded" \ -d "grant_type=password" \ -d "client_id=admin-cli"\ -d "username=bf_test@test.test" \ -d "password=Qwe1234!" \ 'https://test.pp24.dev/auth/realms/PpRealm/protocol/openid-connect/token') error=$(jq -r .error <<< $login_access) if [ $error == "null" ]; then echo "Login successful for test user." else echo "Unable to login test user ($error)." exit 1 fi access_token=$(jq -r '.access_token' <<< "${login_access}") refresh_token=$(jq -r '.refresh_token' <<< "${login_access}") logout_response=$(curl -s -o /dev/null -w '%{http_code}' -k -X POST \ -H "Content-Type:application/x-www-form-urlencoded" \ -H "Authorization: Bearer $access_token" \ -d "client_id=[CLIENT_ID]" \ -d "refresh_token=$refresh_token" \ 'https://test.pp24.dev/auth/realms/PpRealm/protocol/openid-connect/logout') if [ $logout_response -eq 204 ]; then echo "Logout successful for test user." else echo "Unable to logout test user ($logout_response)." exit 1 fi