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.
34 interface AuthenticationProvider
extends LoggerAwareInterface
{
38 * @param AuthManager $manager
40 public function setManager( AuthManager
$manager );
44 * @param Config $config
46 public function setConfig( Config
$config );
49 * Return a unique identifier for this instance
51 * This must be the same across requests. If multiple instances return the
52 * same ID, exceptions will be thrown from AuthManager.
56 public function getUniqueId();
59 * Return the applicable list of AuthenticationRequests
61 * Possible values for $action depend on whether the implementing class is
62 * also a PreAuthenticationProvider, PrimaryAuthenticationProvider, or
63 * SecondaryAuthenticationProvider.
64 * - ACTION_LOGIN: Valid for passing to beginAuthentication. Called on all
66 * - ACTION_CREATE: Valid for passing to beginAccountCreation. Called on
68 * - ACTION_LINK: Valid for passing to beginAccountLink. Called on linking
69 * primary providers only.
70 * - ACTION_CHANGE: Valid for passing to AuthManager::changeAuthenticationData
71 * to change credentials. Called on primary and secondary providers.
72 * - ACTION_REMOVE: Valid for passing to AuthManager::changeAuthenticationData
73 * to remove credentials. Must work without additional user input (i.e.
74 * without calling loadFromSubmission). Called on primary and secondary
77 * @see AuthManager::getAuthenticationRequests()
78 * @param string $action
79 * @param array $options Options are:
80 * - username: User name related to the action, or null/unset if anon.
81 * - ACTION_LOGIN: The currently logged-in user, if any.
82 * - ACTION_CREATE: The account creator, if non-anonymous.
83 * - ACTION_LINK: The local user being linked to.
84 * - ACTION_CHANGE: The user having data changed.
85 * - ACTION_REMOVE: The user having data removed.
86 * This does not need to be copied into the returned requests, you only
87 * need to pay attention to it if the set of requests differs based on
89 * @return AuthenticationRequest[]
91 public function getAuthenticationRequests( $action, array $options );