Merge "Special:Upload should not crash on failing previews"
[mediawiki.git] / includes / auth / AbstractSecondaryAuthenticationProvider.php
blob00493bc7a43e6bd632748e13e0ca71139a4094d6
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 * @ingroup Auth
28 * @since 1.27
30 abstract class AbstractSecondaryAuthenticationProvider extends AbstractAuthenticationProvider
31 implements SecondaryAuthenticationProvider
34 public function continueSecondaryAuthentication( $user, array $reqs ) {
35 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
38 public function postAuthentication( $user, AuthenticationResponse $response ) {
41 public function providerAllowsPropertyChange( $property ) {
42 return true;
45 /**
46 * @inheritdoc
47 * @note Reimplement this if self::getAuthenticationRequests( AuthManager::ACTION_REMOVE )
48 * doesn't return requests that will revoke all access for the user.
50 public function providerRevokeAccessForUser( $username ) {
51 $reqs = $this->getAuthenticationRequests(
52 AuthManager::ACTION_REMOVE, [ 'username' => $username ]
54 foreach ( $reqs as $req ) {
55 $req->username = $username;
56 $this->providerChangeAuthenticationData( $req );
60 public function providerAllowsAuthenticationDataChange(
61 AuthenticationRequest $req, $checkData = true
62 ) {
63 return \StatusValue::newGood( 'ignored' );
66 public function providerChangeAuthenticationData( AuthenticationRequest $req ) {
69 public function testForAccountCreation( $user, $creator, array $reqs ) {
70 return \StatusValue::newGood();
73 public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) {
74 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
77 public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) {
80 public function testUserForCreation( $user, $autocreate, array $options = [] ) {
81 return \StatusValue::newGood();
84 public function autoCreatedAccount( $user, $source ) {