Fixed error in Auth::authenticate causing phpCAS::client to be called twice. 0.7.1
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 6 Mar 2014 09:07:14 +0000 (10:07 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 6 Mar 2014 09:07:14 +0000 (10:07 +0100)
Auth.php
CASLogin.php
CHANGELOG

index e9714d1..c2d9446 100644 (file)
--- 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
index e8df58e..78c62b3 100644 (file)
@@ -24,7 +24,7 @@ class CASLogin extends \Piwik\Plugin
                        'description' => 'CAS Login plugin. It uses JA-SIG Central Authentication Services to authenticate users and grant them access to piwik.',
                        'author' => 'OW',
                         'homepage' => 'http://dev.piwik.org/trac/ticket/598/',
-                        'version' => '0.7',
+                        'version' => '0.7.1',
                );
        }
 
index 582c147..238a010 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 == Changelog ==
+0.7.1
+ * Fixed error in Auth::authenticate causing phpCAS::client to be called twice.
+
 0.7
  * Compatible with Piwik 2.1
  * Removed the "additional root logins" option (Piwik handles multiple superusers natively now)