jenkins-bot has submitted this change and it was merged.
Change subject: Log autocreation and autologin attempts in CentralAuth
......................................................................
Log autocreation and autologin attempts in CentralAuth
Note that this might significantly increase the volume of
the 'authmanager' channel, especially if there are many users
who have disabled cookies (so an autologin attempt is triggered
for them on every pageview).
Bug: T125184
Change-Id: Ifc6b8a24bb9ae178180c14b0e2f6a0ff7b6c3bf0
---
M includes/CentralAuthUtils.php
M includes/specials/SpecialCentralAutoLogin.php
2 files changed, 22 insertions(+), 2 deletions(-)
Approvals:
BryanDavis: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/CentralAuthUtils.php b/includes/CentralAuthUtils.php
index a0b19a6..7d5682b 100644
--- a/includes/CentralAuthUtils.php
+++ b/includes/CentralAuthUtils.php
@@ -125,10 +125,15 @@
*/
public static function autoCreateUser( User $user ) {
if ( class_exists( 'MediaWiki\\Session\\SessionManager' ) ) {
- return
MediaWiki\Session\SessionManager::autoCreateUser( $user );
+ $res =
MediaWiki\Session\SessionManager::autoCreateUser( $user );
} else {
- return CentralAuthSessionCompat::attemptAddUser( $user
);
+ $res = CentralAuthSessionCompat::attemptAddUser( $user
);
}
+ \MediaWiki\Logger\LoggerFactory::getInstance( 'authmanager'
)->info( 'Autocreation attempt', array(
+ 'event' => 'autocreate',
+ 'successful' => $res,
+ ) );
+ return $res;
}
/**
diff --git a/includes/specials/SpecialCentralAutoLogin.php
b/includes/specials/SpecialCentralAutoLogin.php
index 1b90ce0..a1ae088 100644
--- a/includes/specials/SpecialCentralAutoLogin.php
+++ b/includes/specials/SpecialCentralAutoLogin.php
@@ -81,6 +81,16 @@
function execute( $par ) {
global $wgCentralAuthLoginWiki;
+ if (
+ in_array( $par, array( 'refreshCookies',
'deleteCookies', 'start', 'checkLoggedIn',
+ 'createSession', 'validateSession', 'setCookies' ),
true )
+ ) {
+ \MediaWiki\Logger\LoggerFactory::getInstance(
'authmanager' )->info( 'Autologin ' . $par, array(
+ 'event' => 'autologin',
+ 'type' => $par,
+ ) );
+ }
+
$request = $this->getRequest();
$cache = CentralAuthUtils::getSessionCache();
@@ -514,6 +524,11 @@
}
ScopedCallback::consume( $delay );
+ \MediaWiki\Logger\LoggerFactory::getInstance(
'authmanager' )->info( 'Autologin success', array(
+ 'event' => 'autologin',
+ 'type' => 'success',
+ ) );
+
$script = self::getInlineScript( 'anon-remove.js' );
// If we're returning to returnto, do that
--
To view, visit https://gerrit.wikimedia.org/r/270351
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc6b8a24bb9ae178180c14b0e2f6a0ff7b6c3bf0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[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