assuming-long-roleidnames + object-uuid-based-rolenames #139
34
bin/cas-curl
34
bin/cas-curl
@ -1,18 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$#" -eq 0 ] || [ "$1" == "help" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
|
||||||
cat <<EOF
|
|
||||||
curl-wrapper utilizing CAS-authentication for hsadmin-ng
|
|
||||||
usage: $0 [--trace] [--show-password] <<command>> [parameters]
|
|
||||||
|
|
||||||
commands:
|
|
||||||
EOF
|
|
||||||
# filters out help texts (marked with ## and following lines with #) from the commands itself
|
|
||||||
# (the '' makes sure that this line is not found, just the lines with actual help texts)
|
|
||||||
sed -n '/#''#/ {s/#''#//; p; :a; n; /^[[:space:]]*#/!b; s/^[[:space:]]*#//; p; ba}' $0
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$2" == "--show-password" ]; then
|
if [ "$2" == "--show-password" ]; then
|
||||||
HSADMINNG_CAS_SHOW_PASSWORD=yes
|
HSADMINNG_CAS_SHOW_PASSWORD=yes
|
||||||
shift
|
shift
|
||||||
@ -64,8 +51,16 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function casLogout() {
|
function casCurlDocumentation() {
|
||||||
rm -f ~/.cas-login-tgt
|
cat <<EOF
|
||||||
|
curl-wrapper utilizing CAS-authentication for hsadmin-ng
|
||||||
|
usage: $0 [--trace] [--show-password] <<command>> [parameters]
|
||||||
|
|
||||||
|
commands:
|
||||||
|
EOF
|
||||||
|
# filters out help texts (containing double-# and following lines with leading single-#) from the commands itself
|
||||||
|
# (the '' makes sure that this line is not found, just the lines with actual help texts)
|
||||||
|
sed -n '/#''#/ {x; p; x; s/#''#//; p; :a; n; /^[[:space:]]*#/!b; s/^[[:space:]]*#//; p; ba}' <$0
|
||||||
}
|
}
|
||||||
|
|
||||||
function casLogin() {
|
function casLogin() {
|
||||||
@ -107,6 +102,10 @@ function casLogin() {
|
|||||||
trace "$HSADMINNG_CAS_TGT"
|
trace "$HSADMINNG_CAS_TGT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function casLogout() {
|
||||||
|
rm -f ~/.cas-login-tgt
|
||||||
|
}
|
||||||
|
|
||||||
function casTicket() {
|
function casTicket() {
|
||||||
HSADMINNG_CAS_TGT=$(<~/.cas-login-tgt)
|
HSADMINNG_CAS_TGT=$(<~/.cas-login-tgt)
|
||||||
if [[ -z "$HSADMINNG_CAS_TGT" ]]; then
|
if [[ -z "$HSADMINNG_CAS_TGT" ]]; then
|
||||||
@ -144,6 +143,11 @@ case "${1,,}" in
|
|||||||
|
|
||||||
# -- generic commands --------------------------------------------------------------------------
|
# -- generic commands --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
""|"-h"|"--help"|"help") ## prints documentation about commands and options
|
||||||
|
casCurlDocumentation
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
"env") ## prints all related HSADMINNG_CAS_... environment variables; use '--show-password' to show the password as well
|
"env") ## prints all related HSADMINNG_CAS_... environment variables; use '--show-password' to show the password as well
|
||||||
# example: cas-curl env --show-password
|
# example: cas-curl env --show-password
|
||||||
echo "HSADMINNG_CAS_LOGIN: $HSADMINNG_CAS_LOGIN"
|
echo "HSADMINNG_CAS_LOGIN: $HSADMINNG_CAS_LOGIN"
|
||||||
|
Loading…
Reference in New Issue
Block a user