MediaWiki  master
AbstractSecondaryAuthenticationProvider.php
Go to the documentation of this file.
1 <?php
22 namespace MediaWiki\Auth;
23 
33 {
34 
39  public function continueSecondaryAuthentication( $user, array $reqs ) {
40  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
41  }
42 
47  public function postAuthentication( $user, AuthenticationResponse $response ) {
48  }
49 
54  public function providerAllowsPropertyChange( $property ) {
55  return true;
56  }
57 
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  $this->providerChangeAuthenticationData( $req );
71  }
72  }
73 
79  AuthenticationRequest $req, $checkData = true
80  ) {
81  return \StatusValue::newGood( 'ignored' );
82  }
83 
89  }
90 
95  public function testForAccountCreation( $user, $creator, array $reqs ) {
96  return \StatusValue::newGood();
97  }
98 
103  public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) {
104  throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
105  }
106 
111  public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) {
112  }
113 
118  public function testUserForCreation( $user, $autocreate, array $options = [] ) {
119  return \StatusValue::newGood();
120  }
121 
126  public function autoCreatedAccount( $user, $source ) {
127  }
128 }
A base class that implements some of the boilerplate for an AuthenticationProvider.
A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider.
providerAllowsPropertyChange( $property)
Determine whether a property can change.AuthManager::allowsPropertyChange() bool
testUserForCreation( $user, $autocreate, array $options=[])
Determine whether an account may be created.User being created (not added to the database yet)....
postAccountCreation( $user, $creator, AuthenticationResponse $response)
Post-creation callback.This will be called at the end of an account creation attempt....
postAuthentication( $user, AuthenticationResponse $response)
Post-login callback.This will be called at the end of a login attempt. It will not be called for unfi...
continueSecondaryAuthentication( $user, array $reqs)
Continue an authentication flow.User being authenticated. This may become a "UserValue" in the future...
continueSecondaryAccountCreation( $user, $creator, array $reqs)
Continue an authentication flow.User being created (has been added to the database)....
testForAccountCreation( $user, $creator, array $reqs)
Determine whether an account creation may begin.Called from AuthManager::beginAccountCreation()No nee...
autoCreatedAccount( $user, $source)
Post-auto-creation callback.User being created (has been added to the database now)....
providerRevokeAccessForUser( $username)
Revoke the user's credentials.This may cause the user to no longer exist for the provider,...
providerAllowsAuthenticationDataChange(AuthenticationRequest $req, $checkData=true)
Validate a change of authentication data (e.g.passwords)Return StatusValue::newGood( 'ignored' ) if y...
providerChangeAuthenticationData(AuthenticationRequest $req)
Change or remove authentication data (e.g.passwords)If $req was returned for AuthManager::ACTION_CHAN...
const ACTION_REMOVE
Remove a user's credentials.
This is a value object for authentication requests.
This is a value object to hold authentication response data.
getAuthenticationRequests( $action, array $options)
Return the applicable list of AuthenticationRequests.
A secondary provider mostly acts when the submitted authentication data has already been associated t...
$source