Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/295553

Change subject: Make CentralAuth explicitly say which cookies need to be 
extended
......................................................................

Make CentralAuth explicitly say which cookies need to be extended

We don't want to rely on a $wg config variable for this (users
shouldn't need to understand cookie implementation details), so change
it to use a code-defined list instead.  This just uses the list
from CookieSessionProvider in core, and adds 'User'.

Bug: T68699
Change-Id: I229dbc9f097bb0efc5e3e45c6a3b98ffcf9527e2
Depends-On: Ia3259846433980408f79d44f665e17e15670e8ee
---
M includes/session/CentralAuthSessionProvider.php
M tests/phpunit/CentralAuthSessionProviderTest.php
2 files changed, 6 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/53/295553/1

diff --git a/includes/session/CentralAuthSessionProvider.php 
b/includes/session/CentralAuthSessionProvider.php
index 13edb07..8a1fbfb 100644
--- a/includes/session/CentralAuthSessionProvider.php
+++ b/includes/session/CentralAuthSessionProvider.php
@@ -478,6 +478,12 @@
                return $this->centralCookieOptions['domain'];
        }
 
+       protected function getExtendedLoginCookies() {
+               $cookies = parent::getExtendedLoginCookies();
+               $cookies[] = 'User';
+               return $cookies;
+       }
+
        public function getRememberUserDuration() {
                // CentralAuth needs User and Token cookies to remember the 
user. The fallback to
                // sessions needs UserID as well, so if that one has shorter 
expiration, the remember
diff --git a/tests/phpunit/CentralAuthSessionProviderTest.php 
b/tests/phpunit/CentralAuthSessionProviderTest.php
index a9d4ee9..ff328a4 100644
--- a/tests/phpunit/CentralAuthSessionProviderTest.php
+++ b/tests/phpunit/CentralAuthSessionProviderTest.php
@@ -34,7 +34,6 @@
                $config = new HashConfig( [
                        'CookieExpiration' => 100,
                        'ExtendedLoginCookieExpiration' => 200,
-                       'ExtendedLoginCookies' => [ 'User', 'UserID', 'Token' ],
                        // these are needed by CookieSessionProvider::getConfig
                        'SessionName' => null,
                        'CookiePrefix' => '',
@@ -47,13 +46,5 @@
                $provider->setConfig( $config );
 
                $this->assertSame( 200, $provider->getRememberUserDuration() );
-
-               $config->set( 'ExtendedLoginCookies', [ 'UserID', 'Token' ] );
-
-               $this->assertSame( 100, $provider->getRememberUserDuration() );
-
-               $config->set( 'ExtendedLoginCookies', [ 'User', 'Token' ] );
-
-               $this->assertSame( 100, $provider->getRememberUserDuration() );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/295553
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I229dbc9f097bb0efc5e3e45c6a3b98ffcf9527e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to