3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
22 namespace MediaWiki\Auth
;
25 * A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider
31 abstract class AbstractSecondaryAuthenticationProvider
extends AbstractAuthenticationProvider
32 implements SecondaryAuthenticationProvider
39 public function continueSecondaryAuthentication( $user, array $reqs ) {
40 throw new \
BadMethodCallException( __METHOD__
. ' is not implemented.' );
47 public function postAuthentication( $user, AuthenticationResponse
$response ) {
54 public function providerAllowsPropertyChange( $property ) {
61 * @note Reimplement this if self::getAuthenticationRequests( AuthManager::ACTION_REMOVE )
62 * doesn't return requests that will revoke all access for the user.
64 public function providerRevokeAccessForUser( $username ) {
65 $reqs = $this->getAuthenticationRequests(
66 AuthManager
::ACTION_REMOVE
, [ 'username' => $username ]
68 foreach ( $reqs as $req ) {
69 $req->username
= $username;
70 $this->providerChangeAuthenticationData( $req );
78 public function providerAllowsAuthenticationDataChange(
79 AuthenticationRequest
$req, $checkData = true
81 return \StatusValue
::newGood( 'ignored' );
88 public function providerChangeAuthenticationData( AuthenticationRequest
$req ) {
95 public function testForAccountCreation( $user, $creator, array $reqs ) {
96 return \StatusValue
::newGood();
101 * @stable to override
103 public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) {
104 throw new \
BadMethodCallException( __METHOD__
. ' is not implemented.' );
109 * @stable to override
111 public function postAccountCreation( $user, $creator, AuthenticationResponse
$response ) {
116 * @stable to override
118 public function testUserForCreation( $user, $autocreate, array $options = [] ) {
119 return \StatusValue
::newGood();
124 * @stable to override
126 public function autoCreatedAccount( $user, $source ) {