From f11b0c93e1a3bb90e9618522ef1d1af19fa1c07b Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Sat, 21 Dec 2024 16:04:40 +0100 Subject: [PATCH] remove hardcoded CAS user and add --fail-with-body to curl --- bin/hsadmin-ng | 16 ++++++---------- .../hsadminng/config/CasAuthenticator.java | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bin/hsadmin-ng b/bin/hsadmin-ng index 1857d89c..3dca47d8 100755 --- a/bin/hsadmin-ng +++ b/bin/hsadmin-ng @@ -17,7 +17,7 @@ if [ "$1" == "--trace" ]; then } function doCurl() { set -x - curl "$@" + curl --fail-with-body --header "Authorization: $HSADMINNG_CAS_TICKET" "$@" set +x } shift @@ -26,7 +26,7 @@ else : } function doCurl() { - curl "$@" + curl --fail-with-body --header "Authorization: $HSADMINNG_CAS_TICKET" "$@" } fi @@ -113,26 +113,22 @@ case "$1" in "get") # HTTP GET, add URL as parameter shift HSADMINNG_CAS_TICKET=`casTicket` - #trace "curl -f -s --header \"Authorization: $HSADMINNG_CAS_TICKET\" " "$@" - doCurl -f -H "Authorization: $HSADMINNG_CAS_TICKET" "$*" + doCurl "$*" ;; "post") # HTTP POST, add curl options to specify the request body and the URL as last parameter shift HSADMINNG_CAS_TICKET=`casTicket` - trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" --header \"Content-Type: application/json\" -X POST " "$@" - curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" --header "Content-Type: application/json" -X POST "$@" + doCurl --header "Content-Type: application/json" -X POST "$@" ;; "patch") # HTTP PATCH, add curl options to specify the request body and the URL as last parameter shift HSADMINNG_CAS_TICKET=`casTicket` - trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" --header \"Content-Type: application/json\" -X PATCH " "$@" - curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" --header "Content-Type: application/json" -X POST "$*" + doCurl --header "Content-Type: application/json" -X POST "$*" ;; "delete") # HTTP DELETE, add curl options to specify the request body and the URL as last parameter shift HSADMINNG_CAS_TICKET=`casTicket` - trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" -X DELETE " "$@" - curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" -X POST "$@" + curl -X POST "$@" ;; *) cat >&2 <