48 parent::__construct( $main, $action );
50 $this->authAction = $action ===
'unlinkaccount'
51 ? AuthManager::ACTION_UNLINK
52 : AuthManager::ACTION_REMOVE;
53 $this->operation = $action ===
'unlinkaccount'
55 :
'RemoveCredentials';
57 $this->authManager = $authManager;
61 if ( !$this->
getUser()->isNamed() ) {
62 $this->
dieWithError(
'apierror-mustbeloggedin-removeauth',
'notloggedin' );
69 ->securitySensitiveOperation( $this->operation );
73 $remove = $this->authAction === AuthManager::ACTION_REMOVE
74 ? array_fill_keys( $this->
getConfig()->
get(
78 $this->authManager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
80 return $req->
getUniqueId() === $params[
'request'] &&
81 !isset( $remove[get_class( $req )] );
84 if ( count( $reqs ) !== 1 ) {
85 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
87 $req = reset( $reqs );
90 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
91 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
92 if ( !$status->isGood() ) {
95 $this->authManager->changeAuthenticationData( $req );
118 "action={$action}&request=FooAuthenticationRequest&token=123ABC"
119 =>
"apihelp-{$path}-example-simple",
124 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
129class_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()