34 parent::__construct( $main, $action );
36 $this->authAction = $action ===
'unlinkaccount'
37 ? AuthManager::ACTION_UNLINK
38 : AuthManager::ACTION_REMOVE;
39 $this->operation = $action ===
'unlinkaccount'
41 :
'RemoveCredentials';
43 $this->authManager = $authManager;
47 if ( !$this->
getUser()->isNamed() ) {
48 $this->
dieWithError(
'apierror-mustbeloggedin-removeauth',
'notloggedin' );
55 ->securitySensitiveOperation( $this->operation );
59 $remove = $this->authAction === AuthManager::ACTION_REMOVE
60 ? array_fill_keys( $this->
getConfig()->
get(
64 $this->authManager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
66 return $req->
getUniqueId() === $params[
'request'] &&
67 !isset( $remove[get_class( $req )] );
70 if ( count( $reqs ) !== 1 ) {
71 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
73 $req = reset( $reqs );
76 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
77 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
78 if ( !$status->isGood() ) {
81 $this->authManager->changeAuthenticationData( $req );
108 "action={$action}&request=FooAuthenticationRequest&token=123ABC"
109 =>
"apihelp-{$path}-example-simple",
115 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
120class_alias( ApiRemoveAuthenticationData::class,
'ApiRemoveAuthenticationData' );
This is the main API class, used for both external and internal processing.
A class containing constants representing the names of configuration variables.
const RemoveCredentialsBlacklist
Name constant for the RemoveCredentialsBlacklist setting, for use with Config::get()