MediaWiki REL1_32
MediaWiki\Auth\AuthenticationResponse Class Reference

This is a value object to hold authentication response data. More...

Collaboration diagram for MediaWiki\Auth\AuthenticationResponse:

Static Public Member Functions

static newAbstain ()
 
static newFail (Message $msg)
 
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().
 
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 user name 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.
 

Detailed Description

This is a value object to hold authentication response data.

An AuthenticationResponse represents both the status of the authentication (success, failure, in progress) and it its state (what data is needed to continue).

Since
1.27

Definition at line 37 of file AuthenticationResponse.php.

Member Function Documentation

◆ newAbstain()

static MediaWiki\Auth\AuthenticationResponse::newAbstain ( )
static
Returns
AuthenticationResponse
See also
AuthenticationResponse::ABSTAIN

Definition at line 170 of file AuthenticationResponse.php.

References $ret, and MediaWiki\Auth\AuthenticationResponse\ABSTAIN.

Referenced by MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(), MediaWiki\Auth\AuthManagerTest\provideAccountCreation(), MediaWiki\Auth\AuthManagerTest\provideAccountLink(), MediaWiki\Auth\AuthManagerTest\provideAuthentication(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountLink(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoCreateOnLogin(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testBasics(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testBeginLinkAttempt(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testBeginSecondaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProviderTest\testBeginSecondaryAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testContinueLinkAttempt(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest\testTryReset(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().

◆ newFail()

◆ newPass()

static MediaWiki\Auth\AuthenticationResponse::newPass ( $username = null)
static
Parameters
string | null$usernameLocal username
Returns
AuthenticationResponse
See also
AuthenticationResponse::PASS

Definition at line 134 of file AuthenticationResponse.php.

References $ret, MediaWiki\Auth\AuthenticationResponse\$username, and MediaWiki\Auth\AuthenticationResponse\PASS.

Referenced by MediaWiki\Auth\AuthManager\beginAuthentication(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAccountCreation(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\beginSecondaryAuthentication(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\Auth\AuthManagerTest\provideAccountCreation(), MediaWiki\Auth\AuthManagerTest\provideAccountLink(), MediaWiki\Auth\AuthManagerTest\provideAuthentication(), MediaWiki\Auth\AbstractPreAuthenticationProviderTest\testAbstractPreAuthenticationProvider(), MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest\testAbstractPrimaryAuthenticationProvider(), MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest\testAbstractSecondaryAuthenticationProvider(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreationEmail(), MediaWiki\Auth\AuthManagerTest\testAccountCreationLogging(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoCreateFailOnLogin(), MediaWiki\Auth\AuthManagerTest\testAutoCreateOnLogin(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testBeginSecondaryAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testContinueLinkAttempt(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testPostAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testTestForAuthentication(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest\testTryReset(), and MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset().

◆ newRedirect()

static MediaWiki\Auth\AuthenticationResponse::newRedirect ( array $reqs,
$redirectTarget,
$redirectApiData = null )
static
Parameters
AuthenticationRequest[]$reqsAuthenticationRequests needed to continue
string$redirectTargetURL
mixed | null$redirectApiDataData suitable for adding to an ApiResult
Returns
AuthenticationResponse
See also
AuthenticationResponse::REDIRECT

Definition at line 206 of file AuthenticationResponse.php.

References MediaWiki\Auth\AuthenticationResponse\$redirectApiData, MediaWiki\Auth\AuthenticationResponse\$redirectTarget, $ret, and MediaWiki\Auth\AuthenticationResponse\REDIRECT.

Referenced by MediaWiki\Auth\AuthManagerTest\provideAccountCreation(), MediaWiki\Auth\AuthManagerTest\provideAccountLink(), and MediaWiki\Auth\AuthManagerTest\provideAuthentication().

◆ newRestart()

static MediaWiki\Auth\AuthenticationResponse::newRestart ( Message $msg)
static
Parameters
Message$msg
Returns
AuthenticationResponse
See also
AuthenticationResponse::RESTART

Definition at line 159 of file AuthenticationResponse.php.

References $ret, and MediaWiki\Auth\AuthenticationResponse\RESTART.

Referenced by MediaWiki\Auth\AuthManager\continueAuthentication(), and MediaWiki\Auth\AuthManagerTest\provideAuthentication().

◆ newUI()

Member Data Documentation

◆ $createRequest

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 109 of file AuthenticationResponse.php.

◆ $linkRequest

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 119 of file AuthenticationResponse.php.

◆ $loginRequest

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 127 of file AuthenticationResponse.php.

◆ $message

Message null MediaWiki\Auth\AuthenticationResponse::$message = null

I18n message to display in case of UI or FAIL.

Definition at line 82 of file AuthenticationResponse.php.

◆ $messageType

string MediaWiki\Auth\AuthenticationResponse::$messageType = 'warning'

Whether the $message is an error or warning message, for styling reasons.

Definition at line 85 of file AuthenticationResponse.php.

◆ $neededRequests

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 79 of file AuthenticationResponse.php.

◆ $redirectApiData

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 71 of file AuthenticationResponse.php.

Referenced by MediaWiki\Auth\AuthenticationResponse\newRedirect().

◆ $redirectTarget

string null MediaWiki\Auth\AuthenticationResponse::$redirectTarget = null

URL to redirect to for a REDIRECT response.

Definition at line 64 of file AuthenticationResponse.php.

Referenced by MediaWiki\Auth\AuthenticationResponse\newRedirect().

◆ $status

string MediaWiki\Auth\AuthenticationResponse::$status

One of the constants above.

Definition at line 61 of file AuthenticationResponse.php.

◆ $username

string null MediaWiki\Auth\AuthenticationResponse::$username = null

Local user name from authentication.

May be null if the authentication passed but no local user is known.

Definition at line 91 of file AuthenticationResponse.php.

Referenced by MediaWiki\Auth\AuthenticationResponse\newPass().

◆ ABSTAIN

◆ FAIL

const MediaWiki\Auth\AuthenticationResponse::FAIL = 'FAIL'

Indicates that the authentication failed.

Definition at line 42 of file AuthenticationResponse.php.

Referenced by MediaWiki\Auth\AuthManagerAuthPlugin\authenticate(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\AuthenticationResponse\newFail(), MediaWiki\Auth\AuthenticationResponseTest\provideConstructors(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountLink(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoCreateFailOnLogin(), MediaWiki\Auth\AuthManagerTest\testBeginAccountCreation(), MediaWiki\Auth\AuthManagerTest\testBeginAccountLink(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testBeginSecondaryAuthentication(), MediaWiki\Auth\AuthManagerTest\testContinueAccountCreation(), MediaWiki\Auth\AuthManagerTest\testContinueAccountLink(), MediaWiki\Auth\AuthManagerTest\testCreateFromLogin(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testFailResponse(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), and MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testRangeBlock().

◆ PASS

◆ REDIRECT

◆ RESTART

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 49 of file AuthenticationResponse.php.

Referenced by MediaWiki\Auth\AuthenticationResponse\newRestart(), MediaWiki\Auth\AuthenticationResponseTest\provideConstructors(), and MediaWiki\Auth\AuthManagerTest\testAuthentication().

◆ UI


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