MediaWiki master
|
This is a value object to hold authentication response data. More...
Static Public Member Functions | |
static | newAbstain () |
static | newFail (Message $msg, array $failReasons=[]) |
static | newPass ( $username=null) |
static | newRedirect (array $reqs, $redirectTarget, $redirectApiData=null) |
static | newRestart (Message $msg) |
static | newUI (array $reqs, Message $msg, $msgtype='warning') |
Public Attributes | |
AuthenticationRequest null | $createRequest = null |
Returned with a PrimaryAuthenticationProvider login FAIL or a PASS with no username, this can be set to a request that should result in a PASS when passed to that provider's PrimaryAuthenticationProvider::beginPrimaryAccountCreation(). | |
string[] null | $failReasons = null |
String data that is optionally provided on a FAIL. | |
AuthenticationRequest null | $linkRequest = null |
When returned with a PrimaryAuthenticationProvider login PASS with no username, the request this holds will be passed to AuthManager::changeAuthenticationData() once the local user has been determined and the user has confirmed the account ownership (by reviewing the information given by $linkRequest->describeCredentials()). | |
AuthenticationRequest null | $loginRequest = null |
Returned with an AuthManager account creation PASS, this holds a request to pass to AuthManager::beginAuthentication() to immediately log into the created account. | |
Message null | $message = null |
I18n message to display in case of UI or FAIL. | |
string | $messageType = 'warning' |
Whether the $message is an error or warning message, for styling reasons. | |
AuthenticationRequest[] | $neededRequests = [] |
Needed AuthenticationRequests to continue after a UI or REDIRECT response. | |
mixed | $redirectApiData = null |
Data for a REDIRECT response that a client might use to query the remote site via its API rather than by following $redirectTarget. | |
string null | $redirectTarget = null |
URL to redirect to for a REDIRECT response. | |
string | $status |
One of the constants above. | |
string null | $username = null |
Local username from authentication. | |
const | ABSTAIN = 'ABSTAIN' |
Indicates that the authentication provider does not handle this request. | |
const | FAIL = 'FAIL' |
Indicates that the authentication failed. | |
const | PASS = 'PASS' |
Indicates that the authentication succeeded. | |
const | REDIRECT = 'REDIRECT' |
Indicates that the authentication needs to be redirected to a third party to proceed. | |
const | RESTART = 'RESTART' |
Indicates that third-party authentication succeeded but no user exists. | |
const | UI = 'UI' |
Indicates that the authentication needs further user input of some sort. | |
This is a value object to hold authentication response data.
An AuthenticationResponse represents both the status of the authentication (success, failure, in progress) and its state (what data is needed to continue).
Definition at line 38 of file AuthenticationResponse.php.
|
static |
Definition at line 183 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\ABSTAIN.
Referenced by MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().
|
static |
Message | $msg | |
string[] | $failReasons | An array of strings that describes the reason(s) for a login failure |
Definition at line 158 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\$failReasons, and MediaWiki\Auth\AuthenticationResponse\FAIL.
Referenced by MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse().
|
static |
string | null | $username | Local username |
Definition at line 145 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\$username, and MediaWiki\Auth\AuthenticationResponse\PASS.
Referenced by MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().
|
static |
AuthenticationRequest[] | $reqs | AuthenticationRequests needed to continue |
string | $redirectTarget | URL |
mixed | null | $redirectApiData | Data suitable for adding to an ApiResult |
Definition at line 219 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\$redirectApiData, MediaWiki\Auth\AuthenticationResponse\$redirectTarget, and MediaWiki\Auth\AuthenticationResponse\REDIRECT.
|
static |
Message | $msg |
Definition at line 172 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\RESTART.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication().
|
static |
AuthenticationRequest[] | $reqs | AuthenticationRequests needed to continue |
Message | $msg | |
string | $msgtype |
Definition at line 196 of file AuthenticationResponse.php.
References MediaWiki\Auth\AuthenticationResponse\UI.
Referenced by MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().
AuthenticationRequest null MediaWiki\Auth\AuthenticationResponse::$createRequest = null |
Returned with a PrimaryAuthenticationProvider login FAIL or a PASS with no username, this can be set to a request that should result in a PASS when passed to that provider's PrimaryAuthenticationProvider::beginPrimaryAccountCreation().
The client will be able to send that back for expedited account creation where only the username needs to be filled.
Returned with an AuthManager login FAIL or RESTART, this holds a CreateFromLoginAuthenticationRequest that may be passed to AuthManager::beginCreateAccount(), possibly in place of any "primary-required" requests. It may also be passed to AuthManager::beginAuthentication() to preserve the list of accounts which can be linked after success (see $linkRequest).
Definition at line 110 of file AuthenticationResponse.php.
string [] null MediaWiki\Auth\AuthenticationResponse::$failReasons = null |
String data that is optionally provided on a FAIL.
It describes information about the failed AuthenticationResponse that shouldn't be shared with the client.
The CheckUser extension uses this so that it can receive whether a login request for a locked account had the correct password. Using the I18n message would allow the client to see if the password they tried on the locked account was correct while this method does not show the client this info.
Definition at line 138 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthenticationResponse\newFail().
AuthenticationRequest null MediaWiki\Auth\AuthenticationResponse::$linkRequest = null |
When returned with a PrimaryAuthenticationProvider login PASS with no username, the request this holds will be passed to AuthManager::changeAuthenticationData() once the local user has been determined and the user has confirmed the account ownership (by reviewing the information given by $linkRequest->describeCredentials()).
The provider should handle that changeAuthenticationData() call by doing the actual linking.
Definition at line 120 of file AuthenticationResponse.php.
AuthenticationRequest null MediaWiki\Auth\AuthenticationResponse::$loginRequest = null |
Returned with an AuthManager account creation PASS, this holds a request to pass to AuthManager::beginAuthentication() to immediately log into the created account.
All provider methods except postAuthentication will be skipped.
Definition at line 128 of file AuthenticationResponse.php.
Message null MediaWiki\Auth\AuthenticationResponse::$message = null |
I18n message to display in case of UI or FAIL.
Definition at line 83 of file AuthenticationResponse.php.
string MediaWiki\Auth\AuthenticationResponse::$messageType = 'warning' |
Whether the $message is an error or warning message, for styling reasons.
Definition at line 86 of file AuthenticationResponse.php.
AuthenticationRequest [] MediaWiki\Auth\AuthenticationResponse::$neededRequests = [] |
Needed AuthenticationRequests to continue after a UI or REDIRECT response.
This plays the same role when continuing authentication as AuthManager::getAuthenticationRequests() does when beginning it.
Definition at line 80 of file AuthenticationResponse.php.
mixed MediaWiki\Auth\AuthenticationResponse::$redirectApiData = null |
Data for a REDIRECT response that a client might use to query the remote site via its API rather than by following $redirectTarget.
Value must be something acceptable to ApiResult::addValue().
Definition at line 72 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthenticationResponse\newRedirect().
string null MediaWiki\Auth\AuthenticationResponse::$redirectTarget = null |
URL to redirect to for a REDIRECT response.
Definition at line 65 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthenticationResponse\newRedirect().
string MediaWiki\Auth\AuthenticationResponse::$status |
One of the constants above.
Definition at line 62 of file AuthenticationResponse.php.
string null MediaWiki\Auth\AuthenticationResponse::$username = null |
Local username from authentication.
The value may be null if the authentication passed, but no local user is known.
Definition at line 92 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthenticationResponse\newPass().
const MediaWiki\Auth\AuthenticationResponse::ABSTAIN = 'ABSTAIN' |
Indicates that the authentication provider does not handle this request.
Definition at line 53 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthenticationResponse\newAbstain().
const MediaWiki\Auth\AuthenticationResponse::FAIL = 'FAIL' |
Indicates that the authentication failed.
Definition at line 43 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthenticationResponse\newFail().
const MediaWiki\Auth\AuthenticationResponse::PASS = 'PASS' |
Indicates that the authentication succeeded.
Definition at line 40 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthenticationResponse\newPass(), and MediaWiki\Auth\ThrottlePreAuthenticationProvider\postAuthentication().
const MediaWiki\Auth\AuthenticationResponse::REDIRECT = 'REDIRECT' |
Indicates that the authentication needs to be redirected to a third party to proceed.
Definition at line 59 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthenticationResponse\newRedirect().
const MediaWiki\Auth\AuthenticationResponse::RESTART = 'RESTART' |
Indicates that third-party authentication succeeded but no user exists.
Either treat this like a UI response or pass $this->createRequest to AuthManager::beginCreateAccount(). For use by AuthManager only (providers should just return a PASS with no username).
Definition at line 50 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthenticationResponse\newRestart().
const MediaWiki\Auth\AuthenticationResponse::UI = 'UI' |
Indicates that the authentication needs further user input of some sort.
Definition at line 56 of file AuthenticationResponse.php.
Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthenticationResponse\newUI().