summaryrefslogtreecommitdiff
path: root/do-as
blob: d47301bd65f9111a89920b76ac48d641fa8272a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

# Usage:
#    ./do-as <username> <last part of URL> [<any additional curl args>]
# Example:
#    ./do-as user1 get
#    ./do-as user3 delete/1642091653617 -X DELETE

set -e

USER=$1
CMD=$2
shift
shift

JWT=$(curl http://localhost:8000/api/v1.0/auth -X POST -p -u "$USER:pwd" | jq -r .access_token)
curl -H "Authorization: Bearer $JWT" https://localhost:1443/sc/v0/$CMD "$@"