summaryrefslogtreecommitdiff
path: root/do-as
diff options
context:
space:
mode:
authorKristofer Hallin <kristofer@sunet.se>2022-01-17 14:01:08 +0100
committerKristofer Hallin <kristofer@sunet.se>2022-01-17 14:01:08 +0100
commitbb5029d512a58021718061aca439383c8b11e575 (patch)
tree74354b6bf55a9159695eea695653ef03009e5ad4 /do-as
parent571997129ba5275cc5e148a8ac1c0f64d895a9ef (diff)
parent0b55f7ff7cdd3b78bd9992063208476c1c080a02 (diff)
* Merge branch 'main' into feature.callhome
* New API endpoints * Updated requirements
Diffstat (limited to 'do-as')
-rwxr-xr-xdo-as17
1 files changed, 17 insertions, 0 deletions
diff --git a/do-as b/do-as
new file mode 100755
index 0000000..8d5cdaa
--- /dev/null
+++ b/do-as
@@ -0,0 +1,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 -s -H "Authorization: Bearer $JWT" http://localhost:80/sc/v0/$CMD "$@"