MediaWiki  1.34.0
AbstractPrimaryAuthenticationProvider.php
Go to the documentation of this file.
1 <?php
22 namespace MediaWiki\Auth;
23 
24 use User;
25 
34 {
35 
36  public function continuePrimaryAuthentication( array $reqs ) {
37  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
38  }
39 
41  }
42 
43  public function testUserCanAuthenticate( $username ) {
44  // Assume it can authenticate if it exists
45  return $this->testUserExists( $username );
46  }
47 
54  public function providerNormalizeUsername( $username ) {
55  $name = User::getCanonicalName( $username );
56  return $name === false ? null : $name;
57  }
58 
64  public function providerRevokeAccessForUser( $username ) {
65  $reqs = $this->getAuthenticationRequests(
66  AuthManager::ACTION_REMOVE, [ 'username' => $username ]
67  );
68  foreach ( $reqs as $req ) {
69  $req->username = $username;
70  $req->action = AuthManager::ACTION_REMOVE;
71  $this->providerChangeAuthenticationData( $req );
72  }
73  }
74 
75  public function providerAllowsPropertyChange( $property ) {
76  return true;
77  }
78 
79  public function testForAccountCreation( $user, $creator, array $reqs ) {
80  return \StatusValue::newGood();
81  }
82 
83  public function continuePrimaryAccountCreation( $user, $creator, array $reqs ) {
84  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
85  }
86 
87  public function finishAccountCreation( $user, $creator, AuthenticationResponse $response ) {
88  return null;
89  }
90 
91  public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) {
92  }
93 
94  public function testUserForCreation( $user, $autocreate, array $options = [] ) {
95  return \StatusValue::newGood();
96  }
97 
98  public function autoCreatedAccount( $user, $source ) {
99  }
100 
101  public function beginPrimaryAccountLink( $user, array $reqs ) {
102  if ( $this->accountCreationType() === self::TYPE_LINK ) {
103  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
104  } else {
105  throw new \BadMethodCallException(
106  __METHOD__ . ' should not be called on a non-link provider.'
107  );
108  }
109  }
110 
111  public function continuePrimaryAccountLink( $user, array $reqs ) {
112  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
113  }
114 
116  }
117 
118 }
MediaWiki\Auth\PrimaryAuthenticationProvider\accountCreationType
accountCreationType()
Fetch the account-creation type.
$response
$response
Definition: opensearch_desc.php:38
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\postAuthentication
postAuthentication( $user, AuthenticationResponse $response)
Post-login callback.
Definition: AbstractPrimaryAuthenticationProvider.php:40
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\continuePrimaryAccountCreation
continuePrimaryAccountCreation( $user, $creator, array $reqs)
Continue an account creation flow.
Definition: AbstractPrimaryAuthenticationProvider.php:83
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\autoCreatedAccount
autoCreatedAccount( $user, $source)
Post-auto-creation callback.
Definition: AbstractPrimaryAuthenticationProvider.php:98
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\continuePrimaryAccountLink
continuePrimaryAccountLink( $user, array $reqs)
Continue linking an account to an existing user.
Definition: AbstractPrimaryAuthenticationProvider.php:111
MediaWiki\Auth\PrimaryAuthenticationProvider\providerChangeAuthenticationData
providerChangeAuthenticationData(AuthenticationRequest $req)
Change or remove authentication data (e.g.
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\testForAccountCreation
testForAccountCreation( $user, $creator, array $reqs)
Determine whether an account creation may begin.
Definition: AbstractPrimaryAuthenticationProvider.php:79
MediaWiki\Auth\AuthenticationResponse
This is a value object to hold authentication response data.
Definition: AuthenticationResponse.php:37
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\postAccountCreation
postAccountCreation( $user, $creator, AuthenticationResponse $response)
Post-creation callback.
Definition: AbstractPrimaryAuthenticationProvider.php:91
MediaWiki\Auth\PrimaryAuthenticationProvider\testUserExists
testUserExists( $username, $flags=User::READ_NORMAL)
Test whether the named user exists.
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\continuePrimaryAuthentication
continuePrimaryAuthentication(array $reqs)
Continue an authentication flow.
Definition: AbstractPrimaryAuthenticationProvider.php:36
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\providerNormalizeUsername
providerNormalizeUsername( $username)
Normalize the username for authentication.Any two inputs that would result in the same user being aut...
Definition: AbstractPrimaryAuthenticationProvider.php:54
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\testUserCanAuthenticate
testUserCanAuthenticate( $username)
Test whether the named user can authenticate with this provider.
Definition: AbstractPrimaryAuthenticationProvider.php:43
MediaWiki\Auth\PrimaryAuthenticationProvider\getAuthenticationRequests
getAuthenticationRequests( $action, array $options)
Return the applicable list of AuthenticationRequests.Possible values for $action depend on whether th...
MediaWiki\Auth\AuthManager\ACTION_REMOVE
const ACTION_REMOVE
Remove a user's credentials.
Definition: AuthManager.php:107
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\finishAccountCreation
finishAccountCreation( $user, $creator, AuthenticationResponse $response)
Post-creation callback.
Definition: AbstractPrimaryAuthenticationProvider.php:87
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\providerAllowsPropertyChange
providerAllowsPropertyChange( $property)
Determine whether a property can change.
Definition: AbstractPrimaryAuthenticationProvider.php:75
User\getCanonicalName
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
Definition: User.php:1139
$source
$source
Definition: mwdoc-filter.php:34
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\testUserForCreation
testUserForCreation( $user, $autocreate, array $options=[])
Determine whether an account may be created.
Definition: AbstractPrimaryAuthenticationProvider.php:94
MediaWiki\Auth\AbstractAuthenticationProvider
A base class that implements some of the boilerplate for an AuthenticationProvider.
Definition: AbstractAuthenticationProvider.php:32
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider
A base class that implements some of the boilerplate for a PrimaryAuthenticationProvider.
Definition: AbstractPrimaryAuthenticationProvider.php:32
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\beginPrimaryAccountLink
beginPrimaryAccountLink( $user, array $reqs)
Start linking an account to an existing user.
Definition: AbstractPrimaryAuthenticationProvider.php:101
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\providerRevokeAccessForUser
providerRevokeAccessForUser( $username)
Revoke the user's credentials.This may cause the user to no longer exist for the provider,...
Definition: AbstractPrimaryAuthenticationProvider.php:64
MediaWiki\Auth\AbstractPrimaryAuthenticationProvider\postAccountLink
postAccountLink( $user, AuthenticationResponse $response)
Post-link callback.
Definition: AbstractPrimaryAuthenticationProvider.php:115
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:51
MediaWiki\Auth\PrimaryAuthenticationProvider
A primary authentication provider is responsible for associating the submitted authentication data wi...
Definition: PrimaryAuthenticationProvider.php:75
MediaWiki\Auth
Definition: AbstractAuthenticationProvider.php:22