From 5d11968b69865ae05967ec278860609b2e4411a7 Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Fri, 14 Oct 2022 09:58:34 +0000
Subject: [PATCH] fix usage of phpCAS::proxy(), re #1573

Merge request studip/studip!1074
---
 app/controllers/cas.php                          | 6 ++++--
 lib/classes/auth_plugins/StudipAuthCAS.class.php | 4 ++--
 lib/classes/cas/CAS_PGTStorage_Cache.php         | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/app/controllers/cas.php b/app/controllers/cas.php
index 37cf6804452..680084440a9 100644
--- a/app/controllers/cas.php
+++ b/app/controllers/cas.php
@@ -24,9 +24,11 @@ class CasController extends StudipController
         $pgt = Request::get('pgtId');
         $pgt_iou = Request::get('pgtIou');
         $cas_config = $GLOBALS['STUDIP_AUTH_CONFIG_CAS'];
-        $cas = phpCAS::proxy(CAS_VERSION_2_0, $cas_config['host'], $cas_config['port'], $cas_config['uri'], false);
-        $pgt_storage = new CAS_PGTStorage_Cache($cas);
+        phpCAS::proxy(CAS_VERSION_2_0, $cas_config['host'], $cas_config['port'], $cas_config['uri'], false);
+
+        $pgt_storage = new CAS_PGTStorage_Cache(phpCAS::getCasClient());
         $pgt_storage->write($pgt, $pgt_iou);
+
         $this->render_nothing();
     }
 }
diff --git a/lib/classes/auth_plugins/StudipAuthCAS.class.php b/lib/classes/auth_plugins/StudipAuthCAS.class.php
index 79c3cf8e223..59faaf667bc 100644
--- a/lib/classes/auth_plugins/StudipAuthCAS.class.php
+++ b/lib/classes/auth_plugins/StudipAuthCAS.class.php
@@ -33,8 +33,8 @@ class StudipAuthCAS extends StudipAuthSSO
         if (Request::get('sso') === $this->plugin_name) {
             if ($this->proxy) {
                 URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']);
-                $cas = phpCAS::proxy(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
-                phpCAS::setPGTStorage(new CAS_PGTStorage_Cache($cas));
+                phpCAS::proxy(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
+                phpCAS::setPGTStorage(new CAS_PGTStorage_Cache(phpCAS::getCasClient()));
                 phpCAS::setFixedCallbackURL(URLHelper::getURL('dispatch.php/cas/proxy'));
             } else {
                 phpCAS::client(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
diff --git a/lib/classes/cas/CAS_PGTStorage_Cache.php b/lib/classes/cas/CAS_PGTStorage_Cache.php
index 4c5b41a6da5..284b59134f3 100644
--- a/lib/classes/cas/CAS_PGTStorage_Cache.php
+++ b/lib/classes/cas/CAS_PGTStorage_Cache.php
@@ -26,13 +26,13 @@ class CAS_PGTStorage_Cache extends CAS_PGTStorage_AbstractStorage
 
     /**
      * This method returns an informational string giving informations on the
-     * parameters of the storage.(used for debugging purposes).
+     * parameters of the storage (used for debugging purposes).
      *
      * @return an informational string.
      */
     public function getStorageInfo()
     {
-        return 'cache_class_file=' . Config::get()->cache_class_file;
+        return 'type=' . Config::get()->SYSTEMCACHE['type'];
     }
 
     /**
-- 
GitLab