Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/bin/bash
  2. set -ef
  3. # dont put slash at the end or that would fail
  4. URL=""
  5.  
  6. TOKEN=$(curl -f -k -s -k "${URL}/auth/realms/master/protocol/openid-connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "username=admin" -d 'password=admin' -d 'grant_type=password' -d 'client_id=admin-cli'|python -c 'import sys, json; print json.load(sys.stdin)["access_token"]')
  7.  
  8. curl -f -s -k "${URL}/auth/admin/realms" -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" | python -mjson.tool
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement