32 parent::__construct( $main, $action );
34 $this->authAction = $action ===
'unlinkaccount'
35 ? AuthManager::ACTION_UNLINK
36 : AuthManager::ACTION_REMOVE;
37 $this->operation = $action ===
'unlinkaccount'
39 :
'RemoveCredentials';
43 if ( !$this->
getUser()->isNamed() ) {
44 $this->
dieWithError(
'apierror-mustbeloggedin-removeauth',
'notloggedin' );
53 ->securitySensitiveOperation( $this->operation );
57 $remove = $this->authAction === AuthManager::ACTION_REMOVE
58 ? array_fill_keys( $this->
getConfig()->
get(
62 $this->authManager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
64 return $req->
getUniqueId() === $params[
'request'] &&
65 !isset( $remove[get_class( $req )] );
68 if ( count( $reqs ) !== 1 ) {
69 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
71 $req = reset( $reqs );
74 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
75 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
76 if ( !$status->isGood() ) {
79 $this->authManager->changeAuthenticationData( $req );
106 "action={$action}&request=FooAuthenticationRequest&token=123ABC"
107 =>
"apihelp-{$path}-example-simple",
113 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
118class_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()