Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/273581
Change subject: Take $wgCentralAuthCookies into account when checking
CentralAuthSource
......................................................................
Take $wgCentralAuthCookies into account when checking CentralAuthSource
CentralAuthSessionProvider always falls back to "Local" when the cookies
are disabled, so the check in refreshSessionInfo() needs to be expecting
that.
This also adds in a missing logging statement.
Bug: T128197
Change-Id: I8ef34897d84d42ff382a45c060735b6bf7d65835
---
M includes/session/CentralAuthSessionProvider.php
1 file changed, 21 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/81/273581/1
diff --git a/includes/session/CentralAuthSessionProvider.php
b/includes/session/CentralAuthSessionProvider.php
index ac36536..606aea6 100644
--- a/includes/session/CentralAuthSessionProvider.php
+++ b/includes/session/CentralAuthSessionProvider.php
@@ -197,13 +197,28 @@
if ( isset( $metadata['CentralAuthSource'] ) ) {
$name = $info->getUserInfo()->getName();
if ( $name !== null ) {
- $centralUser =
CentralAuthUser::getInstanceByName( $name );
- if ( $centralUser->exists() &&
- ( $centralUser->isAttached() ||
!User::idFromName( $name, User::READ_LATEST ) )
- ) {
- return $metadata['CentralAuthSource']
=== 'CentralAuth';
+ if ( !$this->enable ) {
+ $source = 'Local';
} else {
- return $metadata['CentralAuthSource']
=== 'Local';
+ $centralUser =
CentralAuthUser::getInstanceByName( $name );
+ if ( $centralUser->exists() &&
+ ( $centralUser->isAttached() ||
!User::idFromName( $name, User::READ_LATEST ) )
+ ) {
+ $source = 'CentralAuth';
+ } else {
+ $source = 'Local';
+ }
+ }
+ if ( $metadata['CentralAuthSource'] !== $source
) {
+ $this->logger->warning(
+ 'Session "{session}":
CentralAuth saved source {saved} != expected source {expected}',
+ [
+ 'session' => $info,
+ 'saved' =>
$metadata['CentralAuthSource'],
+ 'expected' => $source,
+ ]
+ );
+ return false;
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/273581
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ef34897d84d42ff382a45c060735b6bf7d65835
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits