3 * Authentication provider interface
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.
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.
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
24 namespace MediaWiki\Auth
;
27 use Psr\Log\LoggerAwareInterface
;
30 * An AuthenticationProvider is used by AuthManager when authenticating users.
32 * This interface should not be implemented directly; use one of its children.
34 * Authentication providers can be registered via $wgAuthManagerAutoConfig.
39 interface AuthenticationProvider
extends LoggerAwareInterface
{
43 * @param AuthManager $manager
45 public function setManager( AuthManager
$manager );
49 * @param Config $config
51 public function setConfig( Config
$config );
54 * Return a unique identifier for this instance
56 * This must be the same across requests. If multiple instances return the
57 * same ID, exceptions will be thrown from AuthManager.
61 public function getUniqueId();
64 * Return the applicable list of AuthenticationRequests
66 * Possible values for $action depend on whether the implementing class is
67 * also a PreAuthenticationProvider, PrimaryAuthenticationProvider, or
68 * SecondaryAuthenticationProvider.
69 * - ACTION_LOGIN: Valid for passing to beginAuthentication. Called on all
71 * - ACTION_CREATE: Valid for passing to beginAccountCreation. Called on
73 * - ACTION_LINK: Valid for passing to beginAccountLink. Called on linking
74 * primary providers only.
75 * - ACTION_CHANGE: Valid for passing to AuthManager::changeAuthenticationData
76 * to change credentials. Called on primary and secondary providers.
77 * - ACTION_REMOVE: Valid for passing to AuthManager::changeAuthenticationData
78 * to remove credentials. Must work without additional user input (i.e.
79 * without calling loadFromSubmission). Called on primary and secondary
82 * @see AuthManager::getAuthenticationRequests()
83 * @param string $action
84 * @param array $options Options are:
85 * - username: User name related to the action, or null/unset if anon.
86 * - ACTION_LOGIN: The currently logged-in user, if any.
87 * - ACTION_CREATE: The account creator, if non-anonymous.
88 * - ACTION_LINK: The local user being linked to.
89 * - ACTION_CHANGE: The user having data changed.
90 * - ACTION_REMOVE: The user having data removed.
91 * If you leave the username property of the returned requests empty, this
92 * will automatically be copied there (except for ACTION_CREATE where it
93 * wouldn't really make sense).
94 * @return AuthenticationRequest[]
96 public function getAuthenticationRequests( $action, array $options );