Debian Codegraph @

includes/auth/AbstractSecondaryAuthenticationProvider.php

raw symbols SCIP
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.
7 *
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.
12 *
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
17 *
18 * @file
19 * @ingroup Auth
20 */
21
22 namespace MediaWiki\Auth;
23
24 /**
25 * A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider
26 *
27 * @stable to extend
28 * @ingroup Auth
29 * @since 1.27
30 */
31 abstract class AbstractSecondaryAuthenticationProvider extends AbstractAuthenticationProvider
32 implements SecondaryAuthenticationProvider
33 {
34
35 /**
36 * @inheritDoc
37 * @stable to override
38 */
39 public function continueSecondaryAuthentication( $user, array $reqs ) {
40 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
41 }
42
43 /**
44 * @inheritDoc
45 * @stable to override
46 */
47 public function postAuthentication( $user, AuthenticationResponse $response ) {
48 }
49
50 /**
51 * @inheritDoc
52 * @stable to override
53 */
54 public function providerAllowsPropertyChange( $property ) {
55 return true;
56 }
57
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.
63 */
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
74 /**
75 * @inheritDoc
76 * @stable to override
77 */
78 public function providerAllowsAuthenticationDataChange(
79 AuthenticationRequest $req, $checkData = true
80 ) {
81 return \StatusValue::newGood( 'ignored' );
82 }
83
84 /**
85 * @inheritDoc
86 * @stable to override
87 */
88 public function providerChangeAuthenticationData( AuthenticationRequest $req ) {
89 }
90
91 /**
92 * @inheritDoc
93 * @stable to override
94 */
95 public function testForAccountCreation( $user, $creator, array $reqs ) {
96 return \StatusValue::newGood();
97 }
98
99 /**
100 * @inheritDoc
101 * @stable to override
102 */
103 public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) {
104 throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' );
105 }
106
107 /**
108 * @inheritDoc
109 * @stable to override
110 */
111 public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) {
112 }
113
114 /**
115 * @inheritDoc
116 * @stable to override
117 */
118 public function testUserForCreation( $user, $autocreate, array $options = [] ) {
119 return \StatusValue::newGood();
120 }
121
122 /**
123 * @inheritDoc
124 * @stable to override
125 */
126 public function autoCreatedAccount( $user, $source ) {
127 }
128 }