MediaWiki REL1_30
AbstractPrimaryAuthenticationProvider.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
24use User;
25
34{
35
36 public function continuePrimaryAuthentication( array $reqs ) {
37 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
38 }
39
41 }
42
44 // Assume it can authenticate if it exists
45 return $this->testUserExists( $username );
46 }
47
55 $name = User::getCanonicalName( $username );
56 return $name === false ? null : $name;
57 }
58
65 $reqs = $this->getAuthenticationRequests(
66 AuthManager::ACTION_REMOVE, [ 'username' => $username ]
67 );
68 foreach ( $reqs as $req ) {
69 $req->username = $username;
72 }
73 }
74
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}
A base class that implements some of the boilerplate for an AuthenticationProvider.
A base class that implements some of the boilerplate for a PrimaryAuthenticationProvider.
continuePrimaryAuthentication(array $reqs)
Continue an authentication flow.
beginPrimaryAccountLink( $user, array $reqs)
Start linking an account to an existing user.
postAuthentication( $user, AuthenticationResponse $response)
Post-login callback.
testUserCanAuthenticate( $username)
Test whether the named user can authenticate with this provider.
continuePrimaryAccountCreation( $user, $creator, array $reqs)
Continue an account creation flow.
testUserForCreation( $user, $autocreate, array $options=[])
Determine whether an account may be created.
providerAllowsPropertyChange( $property)
Determine whether a property can change.
postAccountCreation( $user, $creator, AuthenticationResponse $response)
Post-creation callback.
continuePrimaryAccountLink( $user, array $reqs)
Continue linking an account to an existing user.
finishAccountCreation( $user, $creator, AuthenticationResponse $response)
Post-creation callback.
postAccountLink( $user, AuthenticationResponse $response)
Post-link callback.
testForAccountCreation( $user, $creator, array $reqs)
Determine whether an account creation may begin.
const ACTION_REMOVE
Remove a user's credentials.
This is a value object to hold authentication response data.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:51
this hook is for auditing only $req
Definition hooks.txt:988
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition hooks.txt:1971
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:783
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
this hook is for auditing only $response
Definition hooks.txt:781
A primary authentication provider is responsible for associating the submitted authentication data wi...
getAuthenticationRequests( $action, array $options)
@inheritDoc
providerChangeAuthenticationData(AuthenticationRequest $req)
Change or remove authentication data (e.g.
testUserExists( $username, $flags=User::READ_NORMAL)
Test whether the named user exists.
accountCreationType()
Fetch the account-creation type.
$source
$property