add CAS authentication #138

Merged
hsh-michaelhoennig merged 24 commits from feature/add-cas-authentication into master 2024-12-23 12:49:46 +01:00
2 changed files with 7 additions and 11 deletions
Showing only changes of commit f11b0c93e1 - Show all commits

View File

@ -17,7 +17,7 @@ if [ "$1" == "--trace" ]; then
} }
function doCurl() { function doCurl() {
set -x set -x
curl "$@" curl --fail-with-body --header "Authorization: $HSADMINNG_CAS_TICKET" "$@"
set +x set +x
} }
shift shift
@ -26,7 +26,7 @@ else
: :
} }
function doCurl() { function doCurl() {
curl "$@" curl --fail-with-body --header "Authorization: $HSADMINNG_CAS_TICKET" "$@"
} }
fi fi
@ -113,26 +113,22 @@ case "$1" in
"get") # HTTP GET, add URL as parameter "get") # HTTP GET, add URL as parameter
shift shift
HSADMINNG_CAS_TICKET=`casTicket` HSADMINNG_CAS_TICKET=`casTicket`
#trace "curl -f -s --header \"Authorization: $HSADMINNG_CAS_TICKET\" " "$@" doCurl "$*"
doCurl -f -H "Authorization: $HSADMINNG_CAS_TICKET" "$*"
;; ;;
"post") # HTTP POST, add curl options to specify the request body and the URL as last parameter "post") # HTTP POST, add curl options to specify the request body and the URL as last parameter
shift shift
HSADMINNG_CAS_TICKET=`casTicket` HSADMINNG_CAS_TICKET=`casTicket`
trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" --header \"Content-Type: application/json\" -X POST " "$@" doCurl --header "Content-Type: application/json" -X POST "$@"
curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" --header "Content-Type: application/json" -X POST "$@"
;; ;;
"patch") # HTTP PATCH, add curl options to specify the request body and the URL as last parameter "patch") # HTTP PATCH, add curl options to specify the request body and the URL as last parameter
shift shift
HSADMINNG_CAS_TICKET=`casTicket` HSADMINNG_CAS_TICKET=`casTicket`
trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" --header \"Content-Type: application/json\" -X PATCH " "$@" doCurl --header "Content-Type: application/json" -X POST "$*"
curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" --header "Content-Type: application/json" -X POST "$*"
;; ;;
"delete") # HTTP DELETE, add curl options to specify the request body and the URL as last parameter "delete") # HTTP DELETE, add curl options to specify the request body and the URL as last parameter
shift shift
HSADMINNG_CAS_TICKET=`casTicket` HSADMINNG_CAS_TICKET=`casTicket`
trace "curl -f --header \"Authorization: $HSADMINNG_CAS_TICKET\" -X DELETE " "$@" curl -X POST "$@"
curl -f -H "Authorization: $HSADMINNG_CAS_TICKET" -X POST "$@"
;; ;;
*) *)
cat >&2 <<EOF cat >&2 <<EOF

View File

@ -64,6 +64,6 @@ public class CasAuthenticator implements Authenticator {
} }
final var userName = doc.getElementsByTagName("cas:user").item(0).getTextContent(); final var userName = doc.getElementsByTagName("cas:user").item(0).getTextContent();
System.err.println("CAS-user: " + userName); System.err.println("CAS-user: " + userName);
return "superuser-alex@hostsharing.net"; // userName; return userName;
} }
} }