File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Step 1: Login to get the token
4+ login_response=$( curl -s -X POST http://localhost:8080/login \
5+ -H " Content-Type: application/json" \
6+ -d ' {"username": "Jessica Pearson", "password": "iamthebest"}' )
7+
8+ # Step 2: Extract token using jq (requires jq to be installed)
9+ token=$( echo " $login_response " | jq -r ' .token' )
10+
11+ # Optional: check if token is empty
12+ if [ -z " $token " ] || [ " $token " == " null" ]; then
13+ echo " Failed to get JWT token"
14+ echo " Response: $login_response "
15+ exit 1
16+ fi
17+
18+ while true ; do
19+ # Step 3: Use the token in the authorized request
20+ curl -X POST http://localhost:8080/transactions/schedule \
21+ -H " Authorization: Bearer $token " \
22+ -H " Content-Type: application/json" \
23+ -d ' {
24+ "operation": "setfacl",
25+ "targetPath": "/var/www/html",
26+ "entries": [
27+ {
28+ "entityType": "user",
29+ "entity": "alice",
30+ "permissions": "rwx",
31+ "action": "add"
32+ }
33+ ]
34+ }'
35+ done
You can’t perform that action at this time.
0 commit comments