MediaWiki master
MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider Class Reference

Inherits MediaWiki\Auth\AbstractPreAuthenticationProvider.

Collaboration diagram for MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider:

Public Member Functions

 __construct (private readonly IConnectionProvider $dbProvider, private readonly UserFactory $userFactory, array $params=[],)
 
 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: Username 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 and ACTION_LOGIN).
Returns
AuthenticationRequest[]
Stability: stable
to override

 
 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 "UserIdentity" in the future.
User$creatorUser doing the creation. This may become a "UserIdentity" in the future.
AuthenticationRequest[]$reqs
Returns
StatusValue
Stability: stable
to override

 
 testUserForCreation ( $user, $autocreate, array $options=[])
 Determine whether an account may be created.
Parameters
User$userUser being created (not added to the database yet). This may become a "UserIdentity" in the future.
bool | string$autocreateFalse if this is not an auto-creation, or the source of the auto-creation passed to AuthManager::autoCreateUser().
array{flags?:int,creating?:bool,canAlwaysAutocreate?:bool,performer?:User|

\MediaWiki\Permissions\Authority} $options Options for the account creation check.

  • flags: Bitfield of IDBAccessObject::READ_* constants, default IDBAccessObject::READ_NORMAL.
  • creating: If false (or missing), this call is only testing whether a user could be created. If true, this (non-autocreation) call is for actually creating an account and will be followed by a call to testForAccountCreation(). In this case, the provider might return StatusValue::newGood() here and let the later call to testForAccountCreation() do a more thorough test.
  • canAlwaysAutocreate: If true, the session provider is exempt from autocreate user permission checks.
  • performer: The performer of the action, used for user rights checking.
    Returns
    StatusValue
Stability: stable
to override

 
- Public Member Functions inherited from MediaWiki\Auth\AbstractPreAuthenticationProvider
 postAccountCreation ( $user, $creator, AuthenticationResponse $response)
 Post-creation callback.This will be called at the end of an account creation attempt. It will not be called if the account creation process results in a session timeout (possibly after a successful user creation, while a secondary provider is waiting for a response).
Parameters
User$userUser that was attempted to be created. This may become a "UserIdentity" in the future.
User$creatorUser doing the creation. This may become a "UserIdentity" in the future.
AuthenticationResponse$responseAuthentication response that will be returned (PASS or FAIL)

 
 postAccountLink ( $user, AuthenticationResponse $response)
 Post-link callback.This will be called at the end of an account linking attempt.
Parameters
User$userUser that was attempted to be linked. This may become a "UserIdentity" in the future.
AuthenticationResponse$responseAuthentication response that will be returned (PASS or FAIL)

 
 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 "UserIdentity" in the future.
AuthenticationResponse$responseAuthentication response that will be returned (PASS or FAIL)

 
 testForAccountLink ( $user)
 Determine whether an account may linked to another authentication method.
Parameters
User$userUser being linked. This may become a "UserIdentity" in the future.
Returns
StatusValue

 
 testForAuthentication (array $reqs)
 Determine whether an authentication may begin.Called from AuthManager::beginAuthentication()
Parameters
AuthenticationRequest[]$reqs
Returns
StatusValue

 
- Public Member Functions inherited from MediaWiki\Auth\AbstractAuthenticationProvider
 getUniqueId ()
 Return a unique identifier for this instance.This must be the same across requests. If multiple instances return the same ID, exceptions will be thrown from AuthManager.
Returns
string

 
 init (LoggerInterface $logger, AuthManager $manager, HookContainer $hookContainer, Config $config, UserNameUtils $userNameUtils)
 Initialise with dependencies of an AuthenticationProvider.
 

Protected Member Functions

 previouslyRenamedAccountStatus (string $username, int $flags)
 
- Protected Member Functions inherited from MediaWiki\Auth\AbstractAuthenticationProvider
 getHookContainer ()
 
 getHookRunner ()
 
 postInitSetup ()
 A provider can override this to do any necessary setup after init() is called.
 

Additional Inherited Members

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

Detailed Description

Stability: stable
to extend

Definition at line 15 of file PreviouslyRenamedAccountPreAuthenticationProvider.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider::__construct ( private readonly IConnectionProvider $dbProvider,
private readonly UserFactory $userFactory,
array $params = [] )

Member Function Documentation

◆ getAuthenticationRequests()

MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider::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: Username 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 and ACTION_LOGIN).
Returns
AuthenticationRequest[]
Stability: stable
to override

Stability: stable
to override

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 28 of file PreviouslyRenamedAccountPreAuthenticationProvider.php.

References MediaWiki\Auth\AuthManager\ACTION_CREATE.

◆ previouslyRenamedAccountStatus()

MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider::previouslyRenamedAccountStatus ( string $username,
int $flags )
protected
Parameters
string$usernameUsername. Make sure to handle spaces and underscores correctly, as usernames are stored in different formats in different places.
int$flagsSee DBAccessObjectUtils::getDBFromRecency()
Stability: stable
to override

Definition at line 81 of file PreviouslyRenamedAccountPreAuthenticationProvider.php.

Referenced by MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider\testForAccountCreation(), and MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider\testUserForCreation().

◆ testForAccountCreation()

MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider::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 "UserIdentity" in the future.
User$creatorUser doing the creation. This may become a "UserIdentity" in the future.
AuthenticationRequest[]$reqs
Returns
StatusValue
Stability: stable
to override

Stability: stable
to override

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 47 of file PreviouslyRenamedAccountPreAuthenticationProvider.php.

References MediaWiki\Auth\AuthenticationRequest\getRequestByClass(), and MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider\previouslyRenamedAccountStatus().

◆ testUserForCreation()

MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider::testUserForCreation ( $user,
$autocreate,
array $options = [] )

Determine whether an account may be created.

Parameters
User$userUser being created (not added to the database yet). This may become a "UserIdentity" in the future.
bool | string$autocreateFalse if this is not an auto-creation, or the source of the auto-creation passed to AuthManager::autoCreateUser().
array{flags?:int,creating?:bool,canAlwaysAutocreate?:bool,performer?:User|

\MediaWiki\Permissions\Authority} $options Options for the account creation check.

  • flags: Bitfield of IDBAccessObject::READ_* constants, default IDBAccessObject::READ_NORMAL.
  • creating: If false (or missing), this call is only testing whether a user could be created. If true, this (non-autocreation) call is for actually creating an account and will be followed by a call to testForAccountCreation(). In this case, the provider might return StatusValue::newGood() here and let the later call to testForAccountCreation() do a more thorough test.
  • canAlwaysAutocreate: If true, the session provider is exempt from autocreate user permission checks.
  • performer: The performer of the action, used for user rights checking.
    Returns
    StatusValue
Stability: stable
to override

Stability: stable
to override

Reimplemented from MediaWiki\Auth\AbstractPreAuthenticationProvider.

Definition at line 66 of file PreviouslyRenamedAccountPreAuthenticationProvider.php.

References MediaWiki\Auth\PreviouslyRenamedAccountPreAuthenticationProvider\previouslyRenamedAccountStatus().


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