jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Gergő Tisza: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I8ef34897d84d42ff382a45c060735b6bf7d65835
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits