X-Git-Url: https://git.mdrn.pl/piwik-CASLogin.git/blobdiff_plain/237569a1cfdd478618b0ecda78a7ac13548c515f..da6f7c41eceec513d592d5381d3005e427043ae2:/Auth.php?ds=inline diff --git a/Auth.php b/Auth.php index e9714d1..799d38a 100644 --- a/Auth.php +++ b/Auth.php @@ -28,6 +28,7 @@ class Auth implements \Piwik\Auth { protected $login = null; protected $token_auth = null; + private static $phpcas_client_called = false; public function getName() { @@ -50,8 +51,7 @@ class Auth implements \Piwik\Auth // The first authenticate() is from the page, and the second is due to an API call. // This checks if there was already a phpcas instance already initialized, otherwize // phpCAS::client() would fail. - global $PHPCAS_CLIENT; - if(!is_object($PHPCAS_CLIENT)) { + if (!self::$phpcas_client_called) { \phpCAS::client( constant( Config::getInstance()->caslogin['protocol'] ), Config::getInstance()->caslogin['host'], @@ -59,6 +59,7 @@ class Auth implements \Piwik\Auth '', false ); + self::$phpcas_client_called = true; } // no SSL validation for the CAS server @@ -133,11 +134,17 @@ class Auth implements \Piwik\Auth { $this->login = $login; } + public function getLogin() { + return $this->login; + } public function setTokenAuth($token_auth) { $this->token_auth = $token_auth; } + public function getTokenAuthSecret() { + return $this->token_auth; + } /** * This method is used to inject user into Piwik's tables. @@ -196,6 +203,9 @@ class Auth implements \Piwik\Auth ) ); } - + + // Those methods are required by Piwik API. + public function setPassword($password) {} + public function setPasswordHash($passwordHash) {} }