MediaWiki REL1_37
|
This serves as the entry point to the authentication system. More...
Public Member Functions | |
__construct (WebRequest $request, Config $config, ObjectFactory $objectFactory, HookContainer $hookContainer, ReadOnlyMode $readOnlyMode, UserNameUtils $userNameUtils, BlockManager $blockManager, WatchlistManager $watchlistManager, ILoadBalancer $loadBalancer, Language $contentLanguage, LanguageConverterFactory $languageConverterFactory, BotPasswordStore $botPasswordStore, UserFactory $userFactory, UserIdentityLookup $userIdentityLookup, UserOptionsManager $userOptionsManager) | |
forcePrimaryAuthenticationProviders (array $providers, $why) | |
Force certain PrimaryAuthenticationProviders. | |
getRequest () | |
setLogger (LoggerInterface $logger) | |
Authentication | |
canAuthenticateNow () | |
Indicate whether user authentication is possible. | |
beginAuthentication (array $reqs, $returnToUrl) | |
Start an authentication flow. | |
continueAuthentication (array $reqs) | |
Continue an authentication flow. | |
securitySensitiveOperationStatus ( $operation) | |
Whether security-sensitive operations should proceed. | |
userCanAuthenticate ( $username) | |
Determine whether a username can authenticate. | |
normalizeUsername ( $username) | |
Provide normalized versions of the username for security checks. | |
Authentication data changing | |
revokeAccessForUser ( $username) | |
Revoke any authentication credentials for a user. | |
allowsAuthenticationDataChange (AuthenticationRequest $req, $checkData=true) | |
Validate a change of authentication data (e.g. | |
changeAuthenticationData (AuthenticationRequest $req, $isAddition=false) | |
Change authentication data (e.g. | |
Account creation | |
canCreateAccounts () | |
Determine whether accounts can be created. | |
canCreateAccount ( $username, $options=[]) | |
Determine whether a particular account can be created. | |
checkAccountCreatePermissions (Authority $creator) | |
Basic permissions checks on whether a user can create accounts. | |
beginAccountCreation (Authority $creator, array $reqs, $returnToUrl) | |
Start an account creation flow. | |
continueAccountCreation (array $reqs) | |
Continue an account creation flow. | |
autoCreateUser (User $user, $source, $login=true, $log=true) | |
Auto-create an account, and optionally log into that account. | |
Account linking | |
canLinkAccounts () | |
Determine whether accounts can be linked. | |
beginAccountLink (User $user, array $reqs, $returnToUrl) | |
Start an account linking flow. | |
continueAccountLink (array $reqs) | |
Continue an account linking flow. | |
Public Attributes | |
const | ACTION_CHANGE = 'change' |
Change a user's credentials. | |
const | ACTION_CREATE = 'create' |
Create a new user. | |
const | ACTION_CREATE_CONTINUE = 'create-continue' |
Continue a user creation process that was interrupted by the need for user input or communication with an external provider. | |
const | ACTION_LINK = 'link' |
Link an existing user to a third-party account. | |
const | ACTION_LINK_CONTINUE = 'link-continue' |
Continue a user linking process that was interrupted by the need for user input or communication with an external provider. | |
const | ACTION_LOGIN = 'login' |
Log in with an existing (not necessarily local) user. | |
const | ACTION_LOGIN_CONTINUE = 'login-continue' |
Continue a login process that was interrupted by the need for user input or communication with an external provider. | |
const | ACTION_REMOVE = 'remove' |
Remove a user's credentials. | |
const | ACTION_UNLINK = 'unlink' |
Like ACTION_REMOVE but for linking providers only. | |
const | AUTOCREATE_SOURCE_MAINT = '::Maintenance::' |
Auto-creation is due to a Maintenance script. | |
const | AUTOCREATE_SOURCE_SESSION = \MediaWiki\Session\SessionManager::class |
Auto-creation is due to SessionManager. | |
const | SEC_FAIL = 'fail' |
Security-sensitive should not be performed. | |
const | SEC_OK = 'ok' |
Security-sensitive operations are ok. | |
const | SEC_REAUTH = 'reauth' |
Security-sensitive operations should re-authenticate. | |
Information methods | |
getAuthenticationRequests ( $action, UserIdentity $user=null) | |
Return the applicable list of AuthenticationRequests. | |
userExists ( $username, $flags=User::READ_NORMAL) | |
Determine whether a username exists. | |
allowsPropertyChange ( $property) | |
Determine whether a user property should be allowed to be changed. | |
getAuthenticationProvider ( $id) | |
Get a provider by ID. | |
getAuthenticationRequestsInternal ( $providerAction, array $options, array $providers, UserIdentity $user=null) | |
Internal request lookup for self::getAuthenticationRequests. | |
fillRequests (array &$reqs, $action, $username, $forceAction=false) | |
Set values in an array of requests. | |
Internal methods | |
setAuthenticationSessionData ( $key, $data) | |
Store authentication in the current session. | |
getAuthenticationSessionData ( $key, $default=null) | |
Fetch authentication data from the current session. | |
removeAuthenticationSessionData ( $key) | |
Remove authentication data. | |
getConfiguration () | |
setSessionDataForUser ( $user, $remember=null) | |
Log the user in. | |
setDefaultUserOptions (User $user, $useContextLang) | |
callMethodOnProviders ( $which, $method, array $args) | |
getHookContainer () | |
getHookRunner () | |
providerArrayFromSpecs ( $class, array $specs) | |
Create an array of AuthenticationProviders from an array of ObjectFactory specs. | |
getPreAuthenticationProviders () | |
Get the list of PreAuthenticationProviders. | |
getPrimaryAuthenticationProviders () | |
Get the list of PrimaryAuthenticationProviders. | |
getSecondaryAuthenticationProviders () | |
Get the list of SecondaryAuthenticationProviders. | |
This serves as the entry point to the authentication system.
In the future, it may also serve as the entry point to the authorization system.
If you are looking at this because you are working on an extension that creates its own login or signup page, then 1) you really shouldn't do that, 2) if you feel you absolutely have to, subclass AuthManagerSpecialPage or build it on the client side using the clientlogin or the createaccount API. Trying to call this class directly will very likely end up in security vulnerabilities or broken UX in edge cases.
If you are working on an extension that needs to integrate with the authentication system (e.g. by providing a new login method, or doing extra permission checks), you'll probably need to write an AuthenticationProvider.
If you want to create a "reserved" user programmatically, User::newSystemUser() might be what you are looking for. If you want to change user data, use User::changeAuthenticationData(). Code that is related to some SessionProvider or PrimaryAuthenticationProvider can create a (non-reserved) user by calling AuthManager::autoCreateUser(); it is then the provider's responsibility to ensure that the user can authenticate somehow (see especially PrimaryAuthenticationProvider::autoCreatedAccount()). The same functionality can also be used from Maintenance scripts such as createAndPromote.php. If you are writing code that is not associated with such a provider and needs to create accounts programmatically for real users, you should rethink your architecture. There is no good way to do that as such code has no knowledge of what authentication methods are enabled on the wiki and cannot provide any means for users to access the accounts it would create.
The two main control flows when using this class are as follows:
Definition at line 102 of file AuthManager.php.
MediaWiki\Auth\AuthManager::__construct | ( | WebRequest | $request, |
Config | $config, | ||
ObjectFactory | $objectFactory, | ||
HookContainer | $hookContainer, | ||
ReadOnlyMode | $readOnlyMode, | ||
UserNameUtils | $userNameUtils, | ||
BlockManager | $blockManager, | ||
WatchlistManager | $watchlistManager, | ||
ILoadBalancer | $loadBalancer, | ||
Language | $contentLanguage, | ||
LanguageConverterFactory | $languageConverterFactory, | ||
BotPasswordStore | $botPasswordStore, | ||
UserFactory | $userFactory, | ||
UserIdentityLookup | $userIdentityLookup, | ||
UserOptionsManager | $userOptionsManager | ||
) |
WebRequest | $request | |
Config | $config | |
ObjectFactory | $objectFactory | |
HookContainer | $hookContainer | |
ReadOnlyMode | $readOnlyMode | |
UserNameUtils | $userNameUtils | |
BlockManager | $blockManager | |
WatchlistManager | $watchlistManager | |
ILoadBalancer | $loadBalancer | |
Language | $contentLanguage | |
LanguageConverterFactory | $languageConverterFactory | |
BotPasswordStore | $botPasswordStore | |
UserFactory | $userFactory | |
UserIdentityLookup | $userIdentityLookup | |
UserOptionsManager | $userOptionsManager |
Definition at line 224 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$blockManager, MediaWiki\Auth\AuthManager\$botPasswordStore, MediaWiki\Auth\AuthManager\$config, MediaWiki\Auth\AuthManager\$contentLanguage, MediaWiki\Auth\AuthManager\$hookContainer, MediaWiki\Auth\AuthManager\$languageConverterFactory, MediaWiki\Auth\AuthManager\$loadBalancer, MediaWiki\Auth\AuthManager\$objectFactory, MediaWiki\Auth\AuthManager\$readOnlyMode, MediaWiki\Auth\AuthManager\$request, MediaWiki\Auth\AuthManager\$userFactory, MediaWiki\Auth\AuthManager\$userIdentityLookup, MediaWiki\Auth\AuthManager\$userNameUtils, MediaWiki\Auth\AuthManager\$userOptionsManager, MediaWiki\Auth\AuthManager\$watchlistManager, and MediaWiki\Auth\AuthManager\setLogger().
MediaWiki\Auth\AuthManager::allowsAuthenticationDataChange | ( | AuthenticationRequest | $req, |
$checkData = true |
|||
) |
Validate a change of authentication data (e.g.
passwords)
AuthenticationRequest | $req | |
bool | $checkData | If false, $req hasn't been loaded from the submission so checks on user-submitted fields should be skipped. $req->username is considered user-submitted for this purpose, even if it cannot be changed via $req->loadFromSubmission. |
Definition at line 949 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal(), and AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::allowsPropertyChange | ( | $property | ) |
Determine whether a user property should be allowed to be changed.
Supported properties are:
string | $property |
Definition at line 2282 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
Auto-create an account, and optionally log into that account.
PrimaryAuthenticationProviders can invoke this method by returning a PASS from beginPrimaryAuthentication/continuePrimaryAuthentication with the username of a non-existing user. SessionProviders can invoke it by returning a SessionInfo with the username of a non-existing user from provideSessionInfo(). Calling this method explicitly (e.g. from a maintenance script) is also fine.
User | $user | User to auto-create |
string | $source | What caused the auto-creation? This must be one of:
|
bool | $login | Whether to also log the user in |
bool | $log | Whether to generate a user creation log entry (since 1.36) |
Definition at line 1631 of file AuthManager.php.
References $cache, $source, User\addToDatabase(), MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), MediaWiki\Auth\AuthManager\getHookRunner(), User\getId(), User\getName(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders(), User\getUserPage(), User\loadFromId(), User\saveSettings(), MediaWiki\Auth\AuthManager\setDefaultUserOptions(), User\setId(), MediaWiki\Auth\AuthManager\setSessionDataForUser(), and wfMessage().
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication().
MediaWiki\Auth\AuthManager::beginAccountCreation | ( | Authority | $creator, |
array | $reqs, | ||
$returnToUrl | |||
) |
Start an account creation flow.
In addition to the AuthenticationRequests returned by $this->getAuthenticationRequests(), a client might include a CreateFromLoginAuthenticationRequest from a previous login attempt. If $createFromLoginAuthenticationRequest->hasPrimaryStateForAction( AuthManager::ACTION_CREATE )
returns true, any AuthenticationRequest::PRIMARY_REQUIRED requests should be omitted. If the CreateFromLoginAuthenticationRequest has a username set, that username must be used for all other requests.
Authority | $creator | User doing the account creation |
AuthenticationRequest[] | $reqs | |
string | $returnToUrl | Url that REDIRECT responses should eventually return to. |
Definition at line 1124 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\canCreateAccount(), MediaWiki\Auth\AuthManager\canCreateAccounts(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthenticationRequest\getRequestByClass(), MediaWiki\Permissions\Authority\getUser(), MediaWiki\Auth\AuthenticationRequest\getUsernameFromRequests(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthManager\removeAuthenticationSessionData(), and wfMessage().
Referenced by AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::beginAccountLink | ( | User | $user, |
array | $reqs, | ||
$returnToUrl | |||
) |
Start an account linking flow.
User | $user | User being linked |
AuthenticationRequest[] | $reqs | |
string | $returnToUrl | Url that REDIRECT responses should eventually return to. |
Definition at line 1887 of file AuthManager.php.
References $res, MediaWiki\Auth\AuthenticationResponse\ABSTAIN, MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canLinkAccounts(), MediaWiki\Auth\AuthenticationResponse\FAIL, MediaWiki\Auth\AuthManager\fillRequests(), User\getId(), User\getName(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponse\PASS, MediaWiki\Auth\AuthenticationResponse\REDIRECT, MediaWiki\Auth\AuthManager\removeAuthenticationSessionData(), MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_LINK, MediaWiki\Auth\AuthenticationResponse\UI, and wfMessage().
Referenced by AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::beginAuthentication | ( | array | $reqs, |
$returnToUrl | |||
) |
Start an authentication flow.
In addition to the AuthenticationRequests returned by $this->getAuthenticationRequests(), a client might include a CreateFromLoginAuthenticationRequest from a previous login attempt to preserve state.
Instead of the AuthenticationRequests returned by $this->getAuthenticationRequests(), a client might pass a CreatedAccountAuthenticationRequest from an account creation that just succeeded to log in to the just-created account.
AuthenticationRequest[] | $reqs | |
string | $returnToUrl | Url that REDIRECT responses should eventually return to. |
Definition at line 355 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthManager\getHookRunner(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthenticationRequest\getRequestByClass(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponse\newPass(), MediaWiki\Auth\AuthManager\removeAuthenticationSessionData(), and MediaWiki\Auth\AuthManager\setSessionDataForUser().
Referenced by LoginSignupSpecialPage\execute(), and AuthManagerSpecialPage\performAuthenticationStep().
|
private |
int | $which | Bitmask: 1 = pre, 2 = primary, 4 = secondary |
string | $method | |
array | $args |
Definition at line 2521 of file AuthManager.php.
References $args, MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AuthManager\changeAuthenticationData(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthManager\revokeAccessForUser().
MediaWiki\Auth\AuthManager::canAuthenticateNow | ( | ) |
Indicate whether user authentication is possible.
It may not be if the session is provided by something like OAuth for which each individual request includes authentication data.
Definition at line 333 of file AuthManager.php.
Referenced by LoginSignupSpecialPage\execute(), AuthManagerSpecialPage\isActionAllowed(), and MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus().
MediaWiki\Auth\AuthManager::canCreateAccount | ( | $username, | |
$options = [] |
|||
) |
Determine whether a particular account can be created.
string | $username | MediaWiki username |
array | $options |
|
Definition at line 1034 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\canCreateAccounts(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\userExists().
Referenced by MediaWiki\Auth\AuthManager\beginAccountCreation().
MediaWiki\Auth\AuthManager::canCreateAccounts | ( | ) |
Determine whether accounts can be created.
Definition at line 1015 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_CREATE, and MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_LINK.
Referenced by MediaWiki\Auth\AuthManager\beginAccountCreation(), MediaWiki\Auth\AuthManager\canCreateAccount(), MediaWiki\Auth\AuthManager\continueAccountCreation(), LoginSignupSpecialPage\execute(), and AuthManagerSpecialPage\isActionAllowed().
MediaWiki\Auth\AuthManager::canLinkAccounts | ( | ) |
Determine whether accounts can be linked.
Definition at line 1869 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_LINK.
Referenced by MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\continueAccountLink(), and AuthManagerSpecialPage\isActionAllowed().
MediaWiki\Auth\AuthManager::changeAuthenticationData | ( | AuthenticationRequest | $req, |
$isAddition = false |
|||
) |
Change authentication data (e.g.
passwords)
If $req was returned for AuthManager::ACTION_CHANGE, using $req should result in a successful login in the future.
If $req was returned for AuthManager::ACTION_REMOVE, using $req should no longer result in a successful login.
This method should only be called if allowsAuthenticationDataChange( $req, true ) returned success.
AuthenticationRequest | $req | |
bool | $isAddition | Set true if this represents an addition of credentials rather than a change. The main difference is that additions should not invalidate BotPasswords. If you're not sure, leave it false. |
Definition at line 990 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\callMethodOnProviders().
Referenced by AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::checkAccountCreatePermissions | ( | Authority | $creator | ) |
Basic permissions checks on whether a user can create accounts.
Authority | $creator | User doing the account creation |
Definition at line 1082 of file AuthManager.php.
References MediaWiki\Permissions\Authority\authorizeWrite(), MediaWiki\Auth\AuthManager\getRequest(), SpecialPage\getTitleFor(), and wfMessage().
Referenced by MediaWiki\Auth\AuthManager\beginAccountCreation(), and MediaWiki\Auth\AuthManager\continueAccountCreation().
MediaWiki\Auth\AuthManager::continueAccountCreation | ( | array | $reqs | ) |
Continue an account creation flow.
AuthenticationRequest[] | $reqs |
Definition at line 1225 of file AuthManager.php.
References $cache, $res, MediaWiki\Auth\AuthenticationResponse\ABSTAIN, MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canCreateAccounts(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), MediaWiki\Auth\AuthenticationResponse\FAIL, MediaWiki\Auth\AuthManager\fillRequests(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), MediaWiki\Auth\AuthManager\getHookRunner(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthenticationRequest\getRequestByClass(), MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponse\newPass(), MediaWiki\Auth\AuthenticationResponse\PASS, MediaWiki\Auth\AuthenticationResponse\REDIRECT, MediaWiki\Auth\AuthManager\removeAuthenticationSessionData(), MediaWiki\Auth\AuthManager\setDefaultUserOptions(), MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_NONE, MediaWiki\Auth\AuthenticationResponse\UI, and wfMessage().
Referenced by MediaWiki\Auth\AuthManager\beginAccountCreation(), and AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::continueAccountLink | ( | array | $reqs | ) |
Continue an account linking flow.
AuthenticationRequest[] | $reqs |
Definition at line 1996 of file AuthManager.php.
References $res, MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canLinkAccounts(), MediaWiki\Auth\AuthenticationResponse\FAIL, MediaWiki\Auth\AuthManager\fillRequests(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponse\PASS, MediaWiki\Auth\AuthenticationResponse\REDIRECT, MediaWiki\Auth\AuthenticationResponse\UI, and wfMessage().
Referenced by AuthManagerSpecialPage\performAuthenticationStep().
MediaWiki\Auth\AuthManager::continueAuthentication | ( | array | $reqs | ) |
Continue an authentication flow.
Return values are interpreted as follows:
AuthenticationRequest[] | $reqs |
Definition at line 480 of file AuthManager.php.
References $res, MediaWiki\Auth\AuthenticationResponse\ABSTAIN, MediaWiki\Auth\RememberMeAuthenticationRequest\ALWAYS_REMEMBER, MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthenticationResponse\FAIL, MediaWiki\Auth\AuthManager\fillRequests(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal(), MediaWiki\Auth\AuthManager\getHookRunner(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthenticationRequest\getRequestByClass(), MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders(), MediaWiki\Auth\RememberMeAuthenticationRequest\NEVER_REMEMBER, MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponse\newPass(), MediaWiki\Auth\AuthenticationResponse\newRestart(), MediaWiki\Auth\AuthenticationResponse\PASS, MediaWiki\Auth\AuthenticationResponse\REDIRECT, MediaWiki\Auth\AuthManager\removeAuthenticationSessionData(), MediaWiki\Auth\AuthManager\setSessionDataForUser(), MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_LINK, MediaWiki\Auth\AuthenticationResponse\UI, and wfMessage().
Referenced by MediaWiki\Auth\AuthManager\beginAuthentication(), and AuthManagerSpecialPage\performAuthenticationStep().
|
private |
Set values in an array of requests.
AuthenticationRequest[] | &$reqs | |
string | $action | |
string | null | $username | |
bool | $forceAction |
Definition at line 2244 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal().
MediaWiki\Auth\AuthManager::forcePrimaryAuthenticationProviders | ( | array | $providers, |
$why | |||
) |
Force certain PrimaryAuthenticationProviders.
PrimaryAuthenticationProvider[] | $providers | |
string | $why |
Definition at line 280 of file AuthManager.php.
MediaWiki\Auth\AuthManager::getAuthenticationProvider | ( | $id | ) |
Get a provider by ID.
string | $id |
Definition at line 2301 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), and MediaWiki\Auth\AuthManager\continueAuthentication().
MediaWiki\Auth\AuthManager::getAuthenticationRequests | ( | $action, | |
UserIdentity | $user = null |
||
) |
Return the applicable list of AuthenticationRequests.
Possible values for $action:
string | $action | One of the AuthManager::ACTION_* constants |
UserIdentity | null | $user | User being acted on, instead of the current user. |
Definition at line 2110 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\ACTION_CHANGE, MediaWiki\Auth\AuthManager\ACTION_CREATE, MediaWiki\Auth\AuthManager\ACTION_CREATE_CONTINUE, MediaWiki\Auth\AuthManager\ACTION_LINK, MediaWiki\Auth\AuthManager\ACTION_LINK_CONTINUE, MediaWiki\Auth\AuthManager\ACTION_LOGIN, MediaWiki\Auth\AuthManager\ACTION_LOGIN_CONTINUE, MediaWiki\Auth\AuthManager\ACTION_REMOVE, MediaWiki\Auth\AuthManager\ACTION_UNLINK, MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal(), MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders(), and MediaWiki\Auth\PrimaryAuthenticationProvider\TYPE_LINK.
Referenced by AuthManagerSpecialPage\isActionAllowed().
|
private |
Internal request lookup for self::getAuthenticationRequests.
string | $providerAction | Action to pass to providers |
array | $options | Options to pass to providers |
AuthenticationProvider[] | $providers | |
UserIdentity | null | $user | being acted on |
Definition at line 2180 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\ACTION_CREATE, MediaWiki\Auth\AuthManager\ACTION_LOGIN, MediaWiki\Auth\AuthManager\allowsAuthenticationDataChange(), MediaWiki\Auth\AuthManager\fillRequests(), MediaWiki\Auth\AuthenticationProvider\getUniqueId(), MediaWiki\Auth\AuthenticationRequest\OPTIONAL, MediaWiki\Auth\AuthenticationRequest\PRIMARY_REQUIRED, and MediaWiki\Auth\AuthenticationRequest\REQUIRED.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthManager\getAuthenticationRequests().
MediaWiki\Auth\AuthManager::getAuthenticationSessionData | ( | $key, | |
$default = null |
|||
) |
Fetch authentication data from the current session.
string | $key | |
mixed | null | $default |
Definition at line 2353 of file AuthManager.php.
Referenced by LoginSignupSpecialPage\getFieldDefinitions(), AuthManagerSpecialPage\handleReauthBeforeExecute(), and AuthManagerSpecialPage\handleReturnBeforeExecute().
|
private |
Definition at line 2420 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
|
private |
Definition at line 2540 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$hookContainer.
Referenced by MediaWiki\Auth\AuthManager\providerArrayFromSpecs().
|
private |
Definition at line 2547 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$hookRunner.
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus(), and MediaWiki\Auth\AuthManager\setSessionDataForUser().
|
protected |
Get the list of PreAuthenticationProviders.
Definition at line 2428 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$preAuthenticationProviders, MediaWiki\Auth\AuthManager\getConfiguration(), and MediaWiki\Auth\AuthManager\providerArrayFromSpecs().
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canCreateAccount(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), and MediaWiki\Auth\AuthManager\getAuthenticationRequests().
|
protected |
Get the list of PrimaryAuthenticationProviders.
Definition at line 2442 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$primaryAuthenticationProviders, MediaWiki\Auth\AuthManager\getConfiguration(), and MediaWiki\Auth\AuthManager\providerArrayFromSpecs().
Referenced by MediaWiki\Auth\AuthManager\allowsAuthenticationDataChange(), MediaWiki\Auth\AuthManager\allowsPropertyChange(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canCreateAccount(), MediaWiki\Auth\AuthManager\canCreateAccounts(), MediaWiki\Auth\AuthManager\canLinkAccounts(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\normalizeUsername(), MediaWiki\Auth\AuthManager\userCanAuthenticate(), and MediaWiki\Auth\AuthManager\userExists().
MediaWiki\Auth\AuthManager::getRequest | ( | ) |
Definition at line 270 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$request.
Referenced by MediaWiki\Auth\AuthManager\checkAccountCreatePermissions().
|
protected |
Get the list of SecondaryAuthenticationProviders.
Definition at line 2456 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$secondaryAuthenticationProviders, MediaWiki\Auth\AuthManager\getConfiguration(), and MediaWiki\Auth\AuthManager\providerArrayFromSpecs().
Referenced by MediaWiki\Auth\AuthManager\allowsAuthenticationDataChange(), MediaWiki\Auth\AuthManager\allowsPropertyChange(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\callMethodOnProviders(), MediaWiki\Auth\AuthManager\canCreateAccount(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthManager\getAuthenticationProvider(), and MediaWiki\Auth\AuthManager\getAuthenticationRequests().
MediaWiki\Auth\AuthManager::normalizeUsername | ( | $username | ) |
Provide normalized versions of the username for security checks.
Since different providers can normalize the input in different ways, this returns an array of all the different ways the name might be normalized for authentication.
The returned strings should not be revealed to the user, as that might leak private information (e.g. an email address might be normalized to a username).
string | $username |
Definition at line 909 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders().
|
protected |
Create an array of AuthenticationProviders from an array of ObjectFactory specs.
string | $class | |
array[] | $specs |
Definition at line 2386 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getHookContainer().
Referenced by MediaWiki\Auth\AuthManager\getPreAuthenticationProviders(), MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders(), and MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
MediaWiki\Auth\AuthManager::removeAuthenticationSessionData | ( | $key | ) |
Remove authentication data.
string | null | $key | If null, all data is removed |
Definition at line 2367 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\beginAccountCreation(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), AuthManagerSpecialPage\handleReauthBeforeExecute(), and AuthManagerSpecialPage\handleReturnBeforeExecute().
MediaWiki\Auth\AuthManager::revokeAccessForUser | ( | $username | ) |
Revoke any authentication credentials for a user.
After this, the user should no longer be able to log in.
string | $username |
Definition at line 933 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\callMethodOnProviders().
MediaWiki\Auth\AuthManager::securitySensitiveOperationStatus | ( | $operation | ) |
Whether security-sensitive operations should proceed.
A "security-sensitive operation" is something like a password or email change, that would normally have a "reenter your password to confirm" box if we only supported password-based authentication.
string | $operation | Operation being checked. This should be a message-key-like string such as 'change-password' or 'change-email'. |
Definition at line 809 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\canAuthenticateNow(), MediaWiki\Auth\AuthManager\getHookRunner(), MediaWiki\Auth\AuthManager\SEC_FAIL, MediaWiki\Auth\AuthManager\SEC_OK, and MediaWiki\Auth\AuthManager\SEC_REAUTH.
Referenced by AuthManagerSpecialPage\handleReauthBeforeExecute().
MediaWiki\Auth\AuthManager::setAuthenticationSessionData | ( | $key, | |
$data | |||
) |
Store authentication in the current session.
string | $key | |
mixed | $data | Must be serializable |
Definition at line 2336 of file AuthManager.php.
Referenced by LoginSignupSpecialPage\getFieldDefinitions(), AuthManagerSpecialPage\handleReauthBeforeExecute(), and AuthManagerSpecialPage\handleReturnBeforeExecute().
|
private |
User | $user | |
bool | $useContextLang | Use 'uselang' to set the user's language |
Definition at line 2496 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$contentLanguage, $lang, and User\setToken().
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), and MediaWiki\Auth\AuthManager\continueAccountCreation().
MediaWiki\Auth\AuthManager::setLogger | ( | LoggerInterface | $logger | ) |
LoggerInterface | $logger |
Definition at line 263 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\$logger.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Log the user in.
User | $user | |
bool | null | $remember |
Definition at line 2471 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getHookRunner().
Referenced by MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAuthentication(), and MediaWiki\Auth\AuthManager\continueAuthentication().
MediaWiki\Auth\AuthManager::userCanAuthenticate | ( | $username | ) |
Determine whether a username can authenticate.
This is mainly for internal purposes and only takes authentication data into account, not things like blocks that can change without the authentication system being aware.
string | $username | MediaWiki username |
Definition at line 886 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders().
MediaWiki\Auth\AuthManager::userExists | ( | $username, | |
$flags = User::READ_NORMAL |
|||
) |
Determine whether a username exists.
string | $username | |
int | $flags | Bitfield of User:READ_* constants |
Definition at line 2261 of file AuthManager.php.
References MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders().
Referenced by MediaWiki\Auth\AuthManager\canCreateAccount().
|
private |
Definition at line 157 of file AuthManager.php.
|
private |
Definition at line 181 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 196 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 145 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 190 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct(), and MediaWiki\Auth\AuthManager\setDefaultUserOptions().
|
private |
Definition at line 169 of file AuthManager.php.
|
private |
Definition at line 172 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct(), and MediaWiki\Auth\AuthManager\getHookContainer().
|
private |
Definition at line 175 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getHookRunner().
|
private |
Definition at line 193 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 187 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 151 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\setLogger().
|
private |
Definition at line 148 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 160 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getPreAuthenticationProviders().
|
private |
Definition at line 163 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getPrimaryAuthenticationProviders().
|
private |
Definition at line 178 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 142 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct(), and MediaWiki\Auth\AuthManager\getRequest().
|
private |
Definition at line 166 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getSecondaryAuthenticationProviders().
|
private |
Definition at line 199 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 202 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 154 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 205 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
|
private |
Definition at line 184 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\__construct().
const MediaWiki\Auth\AuthManager::ACTION_CHANGE = 'change' |
Change a user's credentials.
Definition at line 122 of file AuthManager.php.
Referenced by MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().
const MediaWiki\Auth\AuthManager::ACTION_CREATE = 'create' |
Create a new user.
Definition at line 110 of file AuthManager.php.
Referenced by MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal(), MediaWiki\Auth\CreateFromLoginAuthenticationRequest\hasPrimaryStateForAction(), and MediaWiki\Auth\CreateFromLoginAuthenticationRequest\hasStateForAction().
const MediaWiki\Auth\AuthManager::ACTION_CREATE_CONTINUE = 'create-continue' |
Continue a user creation process that was interrupted by the need for user input or communication with an external provider.
Definition at line 114 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequests().
const MediaWiki\Auth\AuthManager::ACTION_LINK = 'link' |
Link an existing user to a third-party account.
Definition at line 116 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequests().
const MediaWiki\Auth\AuthManager::ACTION_LINK_CONTINUE = 'link-continue' |
Continue a user linking process that was interrupted by the need for user input or communication with an external provider.
Definition at line 120 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequests().
const MediaWiki\Auth\AuthManager::ACTION_LOGIN = 'login' |
Log in with an existing (not necessarily local) user.
Definition at line 104 of file AuthManager.php.
Referenced by MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequestsInternal(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), and MediaWiki\Auth\CreateFromLoginAuthenticationRequest\hasStateForAction().
const MediaWiki\Auth\AuthManager::ACTION_LOGIN_CONTINUE = 'login-continue' |
Continue a login process that was interrupted by the need for user input or communication with an external provider.
Definition at line 108 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequests().
const MediaWiki\Auth\AuthManager::ACTION_REMOVE = 'remove' |
Remove a user's credentials.
Definition at line 124 of file AuthManager.php.
Referenced by MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\providerRevokeAccessForUser(), and MediaWiki\Auth\AbstractSecondaryAuthenticationProvider\providerRevokeAccessForUser().
const MediaWiki\Auth\AuthManager::ACTION_UNLINK = 'unlink' |
Like ACTION_REMOVE but for linking providers only.
Definition at line 126 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\getAuthenticationRequests().
const MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_MAINT = '::Maintenance::' |
Auto-creation is due to a Maintenance script.
Definition at line 139 of file AuthManager.php.
const MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION = \MediaWiki\Session\SessionManager::class |
Auto-creation is due to SessionManager.
Definition at line 136 of file AuthManager.php.
const MediaWiki\Auth\AuthManager::SEC_FAIL = 'fail' |
Security-sensitive should not be performed.
Definition at line 133 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus().
const MediaWiki\Auth\AuthManager::SEC_OK = 'ok' |
Security-sensitive operations are ok.
Definition at line 129 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus().
const MediaWiki\Auth\AuthManager::SEC_REAUTH = 'reauth' |
Security-sensitive operations should re-authenticate.
Definition at line 131 of file AuthManager.php.
Referenced by MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus().