diff --git a/bin/cas-curl b/bin/cas-curl index 45fa22dd..0e4419c4 100755 --- a/bin/cas-curl +++ b/bin/cas-curl @@ -13,10 +13,16 @@ if [ "$1" == "--trace" ]; then } function doCurl() { set -x - curl --fail-with-body \ - --header "Authorization: $HSADMINNG_CAS_TICKET" \ - --header "assumed-roles: $HSADMINNG_CAS_ASSUME" \ - "$@" + if [ -z "$HSADMINNG_CAS_ASSUME" ]; then + curl --fail-with-body \ + --header "Authorization: $HSADMINNG_CAS_TICKET" \ + "$@" + else + curl --fail-with-body \ + --header "Authorization: $HSADMINNG_CAS_TICKET" \ + --header "assumed-roles: $HSADMINNG_CAS_ASSUME" \ + "$@" + fi set +x } shift diff --git a/src/main/java/net/hostsharing/hsadminng/config/CasAuthenticator.java b/src/main/java/net/hostsharing/hsadminng/config/CasAuthenticator.java index e0d8a9f1..5d6dd116 100644 --- a/src/main/java/net/hostsharing/hsadminng/config/CasAuthenticator.java +++ b/src/main/java/net/hostsharing/hsadminng/config/CasAuthenticator.java @@ -45,13 +45,13 @@ public class CasAuthenticator implements Authenticator { private String casValidation(final HttpServletRequest httpRequest) throws SAXException, IOException, ParserConfigurationException { - System.err.println("CasAuthenticator.casValidation using CAS-server: " + casServerUrl); - final var ticket = httpRequest.getHeader("Authorization"); final var url = casServerUrl + "/p3/serviceValidate" + "?service=" + serviceUrl + "&ticket=" + ticket; + System.err.println("CasAuthenticator.casValidation using URL: " + url); + final var response = restTemplate.getForObject(url, String.class); final var doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()