HSADMINNG_CAS_SERVICE_ID + hsadmin-ng commands case insensitive
This commit is contained in:
parent
88952bef7d
commit
574fb92b9a
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
if [ "$#" -eq 0 ] || [ "$1" == "help" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
if [ "$#" -eq 0 ] || [ "$1" == "help" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
curl-wrapper utilizing CAS-authentification for hsadmin-ng"
|
curl-wrapper utilizing CAS-authentication for hsadmin-ng
|
||||||
usage: $0 [--trace] <<command>> [parameters]
|
usage: $0 [--trace] <<command>> [parameters]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
@ -31,7 +31,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$HSADMINNG_CAS_LOGIN" ] || [ -z "$HSADMINNG_CAS_VALIDATE" ] || \
|
if [ -z "$HSADMINNG_CAS_LOGIN" ] || [ -z "$HSADMINNG_CAS_VALIDATE" ] || \
|
||||||
[ -z "$HSADMINNG_CAS_SERVICE" ]; then
|
[ -z "$HSADMINNG_CAS_SERVICE_ID" ]; then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
ERROR: environment incomplete
|
ERROR: environment incomplete
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ if [ -z "$HSADMINNG_CAS_LOGIN" ] || [ -z "$HSADMINNG_CAS_VALIDATE" ] || \
|
|||||||
export HSADMINNG_CAS_VALIDATE=https://login.hostsharing.net/cas/proxyValidate
|
export HSADMINNG_CAS_VALIDATE=https://login.hostsharing.net/cas/proxyValidate
|
||||||
export HSADMINNG_CAS_USERNAME=<<optionally, your username, or leave empty after '='>>
|
export HSADMINNG_CAS_USERNAME=<<optionally, your username, or leave empty after '='>>
|
||||||
export HSADMINNG_CAS_PASSWORD=<<optionally, your password, or leave empty after '='>>
|
export HSADMINNG_CAS_PASSWORD=<<optionally, your password, or leave empty after '='>>
|
||||||
export HSADMINNG_CAS_SERVICE=https://hsadminng.hostsharing.net:443/
|
export HSADMINNG_CAS_SERVICE_ID=https://hsadminng.hostsharing.net:443/
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -73,8 +73,8 @@ function casTicket() {
|
|||||||
trace "CAS-TGT: $HSADMINNG_CAS_TGT"
|
trace "CAS-TGT: $HSADMINNG_CAS_TGT"
|
||||||
|
|
||||||
trace "fetching CAS service ticket"
|
trace "fetching CAS service ticket"
|
||||||
trace "curl -s -d \"service=$HSADMINNG_CAS_SERVICE\" $HSADMINNG_CAS_TGT"
|
trace "curl -s -d \"service=$HSADMINNG_CAS_SERVICE_ID\" $HSADMINNG_CAS_TGT"
|
||||||
HSADMINNG_CAS_TICKET=$(curl -s -d "service=$HSADMINNG_CAS_SERVICE" $HSADMINNG_CAS_TGT)
|
HSADMINNG_CAS_TICKET=$(curl -s -d "service=$HSADMINNG_CAS_SERVICE_ID" $HSADMINNG_CAS_TGT)
|
||||||
if [[ -z "$HSADMINNG_CAS_TICKET" ]]; then
|
if [[ -z "$HSADMINNG_CAS_TICKET" ]]; then
|
||||||
echo "ERROR: cannot get CAS service ticket" >&2
|
echo "ERROR: cannot get CAS service ticket" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -87,8 +87,8 @@ function casValidate() {
|
|||||||
HSADMINNG_CAS_TICKET=`casTicket`
|
HSADMINNG_CAS_TICKET=`casTicket`
|
||||||
|
|
||||||
trace "validating CAS-TICKET: $HSADMINNG_CAS_TICKET"
|
trace "validating CAS-TICKET: $HSADMINNG_CAS_TICKET"
|
||||||
trace curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE}
|
trace curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE_ID}
|
||||||
HSADMINNG_CAS_USER=`curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE} | grep -oPm1 "(?<=<cas:user>)[^<]+"`
|
HSADMINNG_CAS_USER=`curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE_ID} | grep -oPm1 "(?<=<cas:user>)[^<]+"`
|
||||||
if [ -z "$HSADMINNG_CAS_USER" ]; then
|
if [ -z "$HSADMINNG_CAS_USER" ]; then
|
||||||
echo "validation failed" >&2
|
echo "validation failed" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -100,7 +100,7 @@ if ! find ~/.cas-login-tgt -type f -size +0c -mmin -60 2>/dev/null | grep -q .;
|
|||||||
casLogin
|
casLogin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "${1,,}" in
|
||||||
"login") # explicitly login using CAS-server and credentials in HSADMINNG_CAS_..., fetches ticket granting ticket
|
"login") # explicitly login using CAS-server and credentials in HSADMINNG_CAS_..., fetches ticket granting ticket
|
||||||
casLogin
|
casLogin
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user