MediaWiki  1.33.0
CaptchaPreAuthenticationProvider Class Reference
Inheritance diagram for CaptchaPreAuthenticationProvider:
Collaboration diagram for CaptchaPreAuthenticationProvider:

Public Member Functions

 getAuthenticationRequests ( $action, array $options)
 Return the applicable list of AuthenticationRequests. More...
 
 postAuthentication ( $user, AuthenticationResponse $response)
 Post-login callback. More...
 
 testForAccountCreation ( $user, $creator, array $reqs)
 Determine whether an account creation may begin. More...
 
 testForAuthentication (array $reqs)
 Determine whether an authentication may begin. More...
 
- Public Member Functions inherited from MediaWiki\Auth\AbstractPreAuthenticationProvider
 postAccountCreation ( $user, $creator, AuthenticationResponse $response)
 Post-creation callback. More...
 
 postAccountLink ( $user, AuthenticationResponse $response)
 Post-link callback. More...
 
 testForAccountLink ( $user)
 Determine whether an account may linked to another authentication method. More...
 
 testUserForCreation ( $user, $autocreate, array $options=[])
 Determine whether an account may be created. More...
 
- Public Member Functions inherited from MediaWiki\Auth\AbstractAuthenticationProvider
 getUniqueId ()
 @inheritDoc More...
 
 setConfig (Config $config)
 Set configuration. More...
 
 setLogger (LoggerInterface $logger)
 
 setManager (AuthManager $manager)
 Set AuthManager. More...
 

Protected Member Functions

 makeError ( $message, SimpleCaptcha $captcha)
 
 verifyCaptcha (SimpleCaptcha $captcha, array $reqs, User $user)
 Verify submitted captcha. More...
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Auth\AbstractAuthenticationProvider
Config $config
 
LoggerInterface $logger
 
AuthManager $manager
 

Detailed Description

Definition at line 9 of file CaptchaPreAuthenticationProvider.php.

Member Function Documentation

◆ getAuthenticationRequests()

CaptchaPreAuthenticationProvider::getAuthenticationRequests (   $action,
array  $options 
)

Return the applicable list of AuthenticationRequests.

Possible values for $action depend on whether the implementing class is also a PreAuthenticationProvider, PrimaryAuthenticationProvider, or SecondaryAuthenticationProvider.

  • ACTION_LOGIN: Valid for passing to beginAuthentication. Called on all providers.
  • ACTION_CREATE: Valid for passing to beginAccountCreation. Called on all providers.
  • ACTION_LINK: Valid for passing to beginAccountLink. Called on linking primary providers only.
  • ACTION_CHANGE: Valid for passing to AuthManager::changeAuthenticationData to change credentials. Called on primary and secondary providers.
  • ACTION_REMOVE: Valid for passing to AuthManager::changeAuthenticationData to remove credentials. Must work without additional user input (i.e. without calling loadFromSubmission). Called on primary and secondary providers.
See also
AuthManager::getAuthenticationRequests()
Parameters
string$action
array$optionsOptions are:
  • username: User name related to the action, or null/unset if anon.
    • ACTION_LOGIN: The currently logged-in user, if any.
    • ACTION_CREATE: The account creator, if non-anonymous.
    • ACTION_LINK: The local user being linked to.
    • ACTION_CHANGE: The user having data changed.
    • ACTION_REMOVE: The user having data removed. If you leave the username property of the returned requests empty, this will automatically be copied there (except for ACTION_CREATE where it wouldn't really make sense).
Returns
AuthenticationRequest[]

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 10 of file CaptchaPreAuthenticationProvider.php.

References $options, $user, ConfirmEditHooks\getInstance(), User\newFromName(), and User.

◆ makeError()

CaptchaPreAuthenticationProvider::makeError (   $message,
SimpleCaptcha  $captcha 
)
protected
Parameters
string$messageMessage key
SimpleCaptcha$captcha
Returns
Status

Definition at line 152 of file CaptchaPreAuthenticationProvider.php.

References SimpleCaptcha\getError(), StatusValue\newFatal(), and wfMessage().

Referenced by testForAccountCreation(), and testForAuthentication().

◆ postAuthentication()

CaptchaPreAuthenticationProvider::postAuthentication (   $user,
AuthenticationResponse  $response 
)

Post-login callback.

This will be called at the end of a login attempt. It will not be called for unfinished login attempts that fail by the session timing out.

Note
Under certain circumstances, this can be called even when testForAuthentication was not; see AuthenticationRequest::$loginRequest.
Parameters
User | null$userUser that was attempted to be logged in, if known. This may become a "UserValue" in the future, or User may be refactored into such.
AuthenticationResponse$responseAuthentication response that will be returned (PASS or FAIL)

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 114 of file CaptchaPreAuthenticationProvider.php.

References $response, $user, ConfirmEditHooks\getInstance(), and null.

◆ testForAccountCreation()

CaptchaPreAuthenticationProvider::testForAccountCreation (   $user,
  $creator,
array  $reqs 
)

Determine whether an account creation may begin.

Called from AuthManager::beginAccountCreation()

Note
No need to test if the account exists, AuthManager checks that
Parameters
User$userUser being created (not added to the database yet). This may become a "UserValue" in the future, or User may be refactored into such.
User$creatorUser doing the creation. This may become a "UserValue" in the future, or User may be refactored into such.
AuthenticationRequest[]$reqs
Returns
StatusValue

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 94 of file CaptchaPreAuthenticationProvider.php.

References $success, $user, $username, ConfirmEditHooks\getInstance(), makeError(), StatusValue\newGood(), and verifyCaptcha().

◆ testForAuthentication()

CaptchaPreAuthenticationProvider::testForAuthentication ( array  $reqs)

Determine whether an authentication may begin.

Called from AuthManager::beginAuthentication()

Parameters
AuthenticationRequest[]$reqs
Returns
StatusValue

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 66 of file CaptchaPreAuthenticationProvider.php.

References $success, $username, ConfirmEditHooks\getInstance(), makeError(), StatusValue\newGood(), User, and verifyCaptcha().

◆ verifyCaptcha()

CaptchaPreAuthenticationProvider::verifyCaptcha ( SimpleCaptcha  $captcha,
array  $reqs,
User  $user 
)
protected

Verify submitted captcha.

Assumes that the user has to pass the capctha (permission checks are caller's responsibility).

Parameters
SimpleCaptcha$captcha
AuthenticationRequest[]$reqs
User$user
Returns
bool

Definition at line 137 of file CaptchaPreAuthenticationProvider.php.

References $req, $user, class, and SimpleCaptcha\passCaptchaLimited().

Referenced by testForAccountCreation(), and testForAuthentication().


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