BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
MediaWiki\Auth\Throttler Class Reference
Inheritance diagram for MediaWiki\Auth\Throttler:
Collaboration diagram for MediaWiki\Auth\Throttler:

Public Member Functions

 __construct (array $conditions=null, array $params=[])
 
 setLogger (LoggerInterface $logger)
 
 increase ($username=null, $ip=null, $caller=null)
 
 clear ($username=null, $ip=null)
 

Protected Member Functions

 logRejection (array $context)
 

Static Protected Member Functions

static normalizeThrottleConditions ($throttleConditions)
 

Protected Attributes

 $type
 
 $conditions
 
 $cache
 
 $logger
 
 $warningLimit
 

Constructor & Destructor Documentation

MediaWiki\Auth\Throttler::__construct ( array  $conditions = null,
array  $params = [] 
)
Parameters
array$conditionsAn array of arrays describing throttling conditions. Defaults to $wgPasswordAttemptThrottle. See documentation of that variable for format.
array$paramsParameters (all optional):
  • type: throttle type, used as a namespace for counters,
  • cache: a BagOStuff object where throttle counters are stored.
  • warningLimit: the log level will be raised to warning when rejecting an attempt after no less than this many failures.

Member Function Documentation

MediaWiki\Auth\Throttler::clear (   $username = null,
  $ip = null 
)

Clear the throttle counter.

Should be called after a successful authentication attempt.

Parameters
string | null$username
string | null$ip
Exceptions
\MWException
MediaWiki\Auth\Throttler::increase (   $username = null,
  $ip = null,
  $caller = null 
)

Increase the throttle counter and return whether the attempt should be throttled.

Should be called before an authentication attempt.

Parameters
string | null$username
string | null$ip
string | null$callerThe authentication method from which we were called.
Returns
array|false False if the attempt should not be throttled, an associative array with three keys otherwise:
  • throttleIndex: which throttle condition was met (a key of the conditions array)
  • count: throttle count (ie. number of failed attempts)
  • wait: time in seconds until authentication can be attempted
static MediaWiki\Auth\Throttler::normalizeThrottleConditions (   $throttleConditions)
staticprotected

Handles B/C for $wgPasswordAttemptThrottle.

Parameters
array$throttleConditions
Returns
array
See Also
$wgPasswordAttemptThrottle for structure
MediaWiki\Auth\Throttler::setLogger ( LoggerInterface  $logger)

Sets a logger instance on the object.

Parameters
LoggerInterface$logger
Returns
void

Implements Psr\Log\LoggerAwareInterface.


The documentation for this class was generated from the following file: