28 parent::__construct( $query, $moduleName,
'ami' );
35 'canauthenticatenow' => $this->authManager->canAuthenticateNow(),
36 'cancreateaccounts' => $this->authManager->canCreateAccounts(),
37 'canlinkaccounts' => $this->authManager->canLinkAccounts(),
40 if ( $params[
'securitysensitiveoperation'] !==
null ) {
41 $ret[
'securitysensitiveoperationstatus'] = $this->authManager->securitySensitiveOperationStatus(
42 $params[
'securitysensitiveoperation']
46 if ( $params[
'requestsfor'] ) {
47 $action = $params[
'requestsfor'];
49 $preservedReq = $helper->getPreservedRequest();
50 if ( $preservedReq ) {
52 'haspreservedstate' => $preservedReq->hasStateForAction( $action ),
53 'hasprimarypreservedstate' => $preservedReq->hasPrimaryStateForAction( $action ),
54 'preservedusername' => (string)$preservedReq->username,
58 'haspreservedstate' =>
false,
59 'hasprimarypreservedstate' =>
false,
60 'preservedusername' =>
'',
65 if ( $params[
'reauthenticate'] !==
null ) {
66 if ( !$this->
getUser()->isRegistered() ) {
67 $this->
dieWithError(
'apierror-mustbeloggedin-reauthenticate' );
68 } elseif ( $action !== AuthManager::ACTION_LOGIN ) {
69 $this->
dieWithError( $this->
msg(
'apierror-invalidparammix-mustusewith',
70 'reauthenticate',
'requestsfor=login' ) );
72 $options[
'securityLevel'] = $params[
'reauthenticate'];
74 $reqs = $this->authManager->getAuthenticationRequests( $action, $this->
getUser(), $options );
78 case AuthManager::ACTION_CHANGE:
83 case AuthManager::ACTION_REMOVE:
90 $ret += $helper->formatRequests( $reqs );
104 'securitysensitiveoperation' =>
null,
106 ParamValidator::PARAM_TYPE => [
107 AuthManager::ACTION_LOGIN,
108 AuthManager::ACTION_LOGIN_CONTINUE,
109 AuthManager::ACTION_CREATE,
110 AuthManager::ACTION_CREATE_CONTINUE,
111 AuthManager::ACTION_LINK,
112 AuthManager::ACTION_LINK_CONTINUE,
113 AuthManager::ACTION_CHANGE,
114 AuthManager::ACTION_REMOVE,
115 AuthManager::ACTION_UNLINK,
118 'reauthenticate' => [
127 'action=query&meta=authmanagerinfo&amirequestsfor=' . urlencode( AuthManager::ACTION_LOGIN )
128 =>
'apihelp-query+authmanagerinfo-example-login',
129 'action=query&meta=authmanagerinfo&amirequestsfor=' . urlencode( AuthManager::ACTION_LOGIN ) .
130 '&amimergerequestfields=1'
131 =>
'apihelp-query+authmanagerinfo-example-login-merged',
132 'action=query&meta=authmanagerinfo&amisecuritysensitiveoperation=foo'
133 =>
'apihelp-query+authmanagerinfo-example-securitysensitiveoperation',
139 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Authmanagerinfo';
144class_alias( ApiQueryAuthManagerInfo::class,
'ApiQueryAuthManagerInfo' );
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
A class containing constants representing the names of configuration variables.
const RemoveCredentialsBlacklist
Name constant for the RemoveCredentialsBlacklist setting, for use with Config::get()
const ChangeCredentialsBlacklist
Name constant for the ChangeCredentialsBlacklist setting, for use with Config::get()