diff options
author | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-10-22 17:39:46 +0100 |
---|---|---|
committer | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-10-23 11:17:10 +0000 |
commit | 0709b285d87503f4e3f5fc5352ed132921f15dd5 (patch) | |
tree | 53eb4655b28a191a7a0b0f688645d9d0bf3b7fbf /includes/HookContainer | |
parent | 83d6c6870c1dca7e063bb4ac82c8675b085cc0fb (diff) | |
download | mediawikicore-0709b285d87503f4e3f5fc5352ed132921f15dd5.tar.gz mediawikicore-0709b285d87503f4e3f5fc5352ed132921f15dd5.zip |
Add AuthenticationAttemptThrottled hook
Why:
* A hook is needed to allow extensions to run code when an
authentication throttle causes throttling.
** This is so that we (T&S product) can monitor how many users are
hitting the rate limits for temporary account creation on WMF
wikis.
What:
* Add the AuthenticationAttemptThrottled hook, which is called
from Throttle::increase when the method returns that the action
should be throttled.
* Update the tests for the class to verify the hook is called
when it should be.
Bug: T375500
Change-Id: I614ff6178d4a4f02b5c76d4b8818cb917c4d75aa
Diffstat (limited to 'includes/HookContainer')
-rw-r--r-- | includes/HookContainer/HookRunner.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/HookContainer/HookRunner.php b/includes/HookContainer/HookRunner.php index f002e936fc22..601b8a43848c 100644 --- a/includes/HookContainer/HookRunner.php +++ b/includes/HookContainer/HookRunner.php @@ -49,6 +49,7 @@ use WikiPage; */ class HookRunner implements \MediaWiki\Actions\Hook\GetActionNameHook, + \MediaWiki\Auth\Hook\AuthenticationAttemptThrottledHook, \MediaWiki\Auth\Hook\AuthManagerFilterProvidersHook, \MediaWiki\Auth\Hook\AuthManagerLoginAuthenticateAuditHook, \MediaWiki\Auth\Hook\AuthManagerVerifyAuthenticationHook, @@ -934,6 +935,12 @@ class HookRunner implements ); } + public function onAuthenticationAttemptThrottled( string $type, ?string $username, ?string $ip ) { + return $this->container->run( + 'AuthenticationAttemptThrottled', [ $type, $username, $ip ] + ); + } + public function onAutopromoteCondition( $type, $args, $user, &$result ) { return $this->container->run( 'AutopromoteCondition', |