assuming-long-roleidnames + object-uuid-based-rolenames #139

Merged
hsh-michaelhoennig merged 13 commits from bugfix/assuming-long-roleidnames into master 2024-12-30 10:00:20 +01:00
Showing only changes of commit fa06062dcd - Show all commits

View File

@ -11,13 +11,23 @@ EOF
exit exit
fi fi
export HSADMINNG_CAS_ASSUME_HEADER
if [ -f ~/.cas-curl-assume ]; then
HSADMINNG_CAS_ASSUME="$(cat ~/.cas-curl-assume)"
else
HSADMINNG_CAS_ASSUME=
fi
if [ "$1" == "--trace" ]; then if [ "$1" == "--trace" ]; then
function trace() { function trace() {
echo "$*" >&2 echo "$*" >&2
} }
function doCurl() { function doCurl() {
set -x set -x
curl --fail-with-body --header "Authorization: $HSADMINNG_CAS_TICKET" "$@" curl --fail-with-body \
--header "Authorization: $HSADMINNG_CAS_TICKET" \
--header "assumed-roles: $HSADMINNG_CAS_ASSUME" \
"$@"
set +x set +x
} }
shift shift
@ -76,6 +86,7 @@ function casLogin() {
if [ -z "$HSADMINNG_CAS_TGT" ]; then if [ -z "$HSADMINNG_CAS_TGT" ]; then
echo "ERROR: could not get ticket granting ticket" >&2 echo "ERROR: could not get ticket granting ticket" >&2
cat ~/.cas-login-tgt.response >&2 cat ~/.cas-login-tgt.response >&2
exit 1
fi fi
echo "$HSADMINNG_CAS_TGT" >~/.cas-login-tgt echo "$HSADMINNG_CAS_TGT" >~/.cas-login-tgt
trace "$HSADMINNG_CAS_TGT" trace "$HSADMINNG_CAS_TGT"
@ -121,6 +132,14 @@ case "${1,,}" in
export HSADMINNG_CAS_PASSWORD= export HSADMINNG_CAS_PASSWORD=
casLogin casLogin
;; ;;
"assume") # assumes the given comma-separated roles
shift
if [ -z "$1" ]; then
rm ~/.cas-curl-assume
else
echo "$1" >~/.cas-curl-assume
fi
;;
"logout") # logout, deleting ticket granting ticket "logout") # logout, deleting ticket granting ticket
casLogout casLogout
;; ;;