Debian Codegraph @

includes/auth/AuthenticationProvider.php

raw symbols SCIP
1 <?php
2 /**
3 * Authentication provider interface
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Auth
22 */
23
24 namespace MediaWiki\Auth;
25
26 /**
27 * An AuthenticationProvider is used by AuthManager when authenticating users.
28 *
29 * This interface should not be implemented directly; use one of its children.
30 *
31 * Authentication providers can be registered via $wgAuthManagerAutoConfig.
32 *
33 * @ingroup Auth
34 * @since 1.27
35 */
36 interface AuthenticationProvider {
37
38 /**
39 * Return a unique identifier for this instance
40 *
41 * This must be the same across requests. If multiple instances return the
42 * same ID, exceptions will be thrown from AuthManager.
43 *
44 * @return string
45 */
46 public function getUniqueId();
47
48 /**
49 * Return the applicable list of AuthenticationRequests
50 *
51 * Possible values for $action depend on whether the implementing class is
52 * also a PreAuthenticationProvider, PrimaryAuthenticationProvider, or
53 * SecondaryAuthenticationProvider.
54 * - ACTION_LOGIN: Valid for passing to beginAuthentication. Called on all
55 * providers.
56 * - ACTION_CREATE: Valid for passing to beginAccountCreation. Called on
57 * all providers.
58 * - ACTION_LINK: Valid for passing to beginAccountLink. Called on linking
59 * primary providers only.
60 * - ACTION_CHANGE: Valid for passing to AuthManager::changeAuthenticationData
61 * to change credentials. Called on primary and secondary providers.
62 * - ACTION_REMOVE: Valid for passing to AuthManager::changeAuthenticationData
63 * to remove credentials. Must work without additional user input (i.e.
64 * without calling loadFromSubmission). Called on primary and secondary
65 * providers.
66 *
67 * @see AuthManager::getAuthenticationRequests()
68 * @param string $action
69 * @param array $options Options are:
70 * - username: Username related to the action, or null/unset if anon.
71 * - ACTION_LOGIN: The currently logged-in user, if any.
72 * - ACTION_CREATE: The account creator, if non-anonymous.
73 * - ACTION_LINK: The local user being linked to.
74 * - ACTION_CHANGE: The user having data changed.
75 * - ACTION_REMOVE: The user having data removed.
76 * If you leave the username property of the returned requests empty, this
77 * will automatically be copied there (except for ACTION_CREATE and
78 * ACTION_LOGIN).
79 * @return AuthenticationRequest[]
80 */
81 public function getAuthenticationRequests( $action, array $options );
82
83 }