Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / auth / AbstractSecondaryAuthenticationProvider.php
blobc55180ea27cf8f199f232b48787b5ea1eef7c9a6
1 <?php
2 /**
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
18 * @file
19 * @ingroup Auth
22 namespace MediaWiki\Auth;
24 /**
25 * A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider
27 * @stable to extend
28 * @ingroup Auth
29 * @since 1.27
31 abstract class AbstractSecondaryAuthenticationProvider extends AbstractAuthenticationProvider
32 implements SecondaryAuthenticationProvider
35 /**
36 * @inheritDoc
37 * @stable to override
39 public function continueSecondaryAuthentication( $user, array $reqs ) {
40 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
43 /**
44 * @inheritDoc
45 * @stable to override
47 public function postAuthentication( $user, AuthenticationResponse $response ) {
50 /**
51 * @inheritDoc
52 * @stable to override
54 public function providerAllowsPropertyChange( $property ) {
55 return true;
58 /**
59 * @inheritDoc
60 * @stable to override
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 );
74 /**
75 * @inheritDoc
76 * @stable to override
78 public function providerAllowsAuthenticationDataChange(
79 AuthenticationRequest $req, $checkData = true
80 ) {
81 return \StatusValue::newGood( 'ignored' );
84 /**
85 * @inheritDoc
86 * @stable to override
88 public function providerChangeAuthenticationData( AuthenticationRequest $req ) {
91 /**
92 * @inheritDoc
93 * @stable to override
95 public function testForAccountCreation( $user, $creator, array $reqs ) {
96 return \StatusValue::newGood();
99 /**
100 * @inheritDoc
101 * @stable to override
103 public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) {
104 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
108 * @inheritDoc
109 * @stable to override
111 public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) {
115 * @inheritDoc
116 * @stable to override
118 public function testUserForCreation( $user, $autocreate, array $options = [] ) {
119 return \StatusValue::newGood();
123 * @inheritDoc
124 * @stable to override
126 public function autoCreatedAccount( $user, $source ) {