Skip to content
Snippets Groups Projects
Commit 4b3fec9a authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

update phpCAS API usage for phpCAS 1.5.0, fixes #1573

Closes #1573

Merge request studip/studip!1003
parent 642ce811
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,6 @@
* @category Stud.IP
*/
require_once 'composer/jasig/phpcas/CAS.php';
require_once 'lib/classes/cas/CAS_PGTStorage_Cache.php';
class CasController extends StudipController
......@@ -25,7 +24,7 @@ class CasController extends StudipController
$pgt = Request::get('pgtId');
$pgt_iou = Request::get('pgtIou');
$cas_config = $GLOBALS['STUDIP_AUTH_CONFIG_CAS'];
$cas = new CAS_Client(CAS_VERSION_2_0, true, $cas_config['host'], $cas_config['port'], $cas_config['uri'], false);
$cas = phpCAS::proxy(CAS_VERSION_2_0, $cas_config['host'], $cas_config['port'], $cas_config['uri'], false);
$pgt_storage = new CAS_PGTStorage_Cache($cas);
$pgt_storage->write($pgt, $pgt_iou);
$this->render_nothing();
......
<?php
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
/**
* Stud.IP authentication against CAS Server
*
......@@ -10,18 +7,15 @@
* @package
*/
require_once 'composer/jasig/phpcas/CAS.php';
require_once 'lib/classes/cas/CAS_PGTStorage_Cache.php';
class StudipAuthCAS extends StudipAuthSSO
{
public $host;
public $port;
public $uri;
public $cacert;
public $cas;
public $userdata;
/**
......@@ -37,18 +31,19 @@ class StudipAuthCAS extends StudipAuthSSO
$this->login_description = _('für Single Sign On mit CAS');
}
if (Request::get('sso') === $this->plugin_name) {
$this->cas = new CAS_Client(CAS_VERSION_2_0, $this->proxy, $this->host, $this->port, $this->uri, false);
if ($this->proxy) {
URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']);
$this->cas->setPGTStorage(new CAS_PGTStorage_Cache($this->cas));
$this->cas->setCallbackURL(URLHelper::getURL('dispatch.php/cas/proxy'));
$cas = phpCAS::proxy(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
phpCAS::setPGTStorage(new CAS_PGTStorage_Cache($cas));
phpCAS::setFixedCallbackURL(URLHelper::getURL('dispatch.php/cas/proxy'));
} else {
phpCAS::client(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
}
if (isset($this->cacert)) {
$this->cas->setCasServerCACert($this->cacert);
phpCAS::setCasServerCACert($this->cacert);
} else {
$this->cas->setNoCasServerValidation();
phpCAS::setNoCasServerValidation();
}
}
}
......@@ -58,7 +53,7 @@ class StudipAuthCAS extends StudipAuthSSO
*/
function getUser()
{
return $this->cas->getUser();
return phpCAS::getUser();
}
/**
......@@ -67,7 +62,7 @@ class StudipAuthCAS extends StudipAuthSSO
*/
function verifyUsername($username)
{
$this->cas->forceAuthentication();
phpCAS::forceAuthentication();
return $this->getUser();
}
......@@ -82,13 +77,13 @@ class StudipAuthCAS extends StudipAuthSSO
if (empty($this->userdata)) {
$this->userdata = new $userdataclassname();
}
return $this->userdata->getUserData($key, $this->cas->getUser());
return $this->userdata->getUserData($key, phpCAS::getUser());
}
function logout()
{
// do a global cas logout
$this->cas = new CAS_Client(CAS_VERSION_2_0, false, $this->host, $this->port, $this->uri, false);
$this->cas->logout();
phpCAS::client(CAS_VERSION_2_0, $this->host, $this->port, $this->uri, false);
phpCAS::logout();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment