github.com/djarvur/go-swagger@v0.18.0/examples/composed-auth/exerciser.sh (about) 1 #! /bin/bash 2 curl \ 3 --verbose \ 4 --get \ 5 http://localhost:43016/api/items 6 7 basic=`echo "fred:scrum"|tr -d '\n'|base64 -i` 8 curl \ 9 --verbose \ 10 --get \ 11 --header "Authorization: Basic ${basic}" \ 12 http://localhost:43016/api/account 13 14 basic=`echo "fred:scrum"|tr -d '\n'|base64 -i` 15 curl \ 16 --verbose \ 17 --get \ 18 --header "Authorization: Basic ${basic}" \ 19 "http://localhost:43016/api/order/myOrder?access_token=`cat tokens/token-apikey-customer.jwt`" 20 21 basic=`echo "ivan:terrible"|tr -d '\n'|base64 -i` 22 curl \ 23 --verbose \ 24 -i \ 25 -X POST \ 26 --data '{"orderID": "myorder", "orderLines": [{"quantity": 10, "purchasedItem": "myItem"}]}' \ 27 --header "Content-Type: application/json" \ 28 --header "Authorization: Basic ${basic}" \ 29 "http://localhost:43016/api/order/add?access_token=`cat tokens/token-apikey-customer.jwt`" 30 31 basic=`echo "ivan:terrible"|tr -d '\n'|base64 -i` 32 curl \ 33 --verbose \ 34 -i \ 35 -X POST \ 36 --data '{"orderID": "myorder", "orderLines": [{"quantity": 10, "purchasedItem": "myItem"}]}' \ 37 --header "Content-Type: application/json" \ 38 --header "Authorization: Basic ${basic}" \ 39 --header "X-Custom-Key: `cat tokens/token-apikey-reseller.jwt`" \ 40 "http://localhost:43016/api/order/add?access_token=`cat tokens/token-bearer-inventory-manager.jwt`" 41 42 curl \ 43 --verbose \ 44 --get \ 45 --header "X-Custom-Key: `cat tokens/token-apikey-reseller.jwt`" \ 46 "http://localhost:43016/api/orders/myItem" 47