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' );
51 ->securitySensitiveOperation( $this->operation );
55 $remove = $this->authAction === AuthManager::ACTION_REMOVE
56 ? array_fill_keys( $this->
getConfig()->
get(
60 $this->authManager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
62 return $req->
getUniqueId() === $params[
'request'] &&
63 !isset( $remove[get_class( $req )] );
66 if ( count( $reqs ) !== 1 ) {
67 $this->
dieWithError(
'apierror-changeauth-norequest',
'badrequest' );
69 $req = reset( $reqs );
72 $status = $this->authManager->allowsAuthenticationDataChange( $req,
true );
73 $this->
getHookRunner()->onChangeAuthenticationDataAudit( $req, $status );
74 if ( !$status->isGood() ) {
77 $this->authManager->changeAuthenticationData( $req );
104 "action={$action}&request=FooAuthenticationRequest&token=123ABC"
105 =>
"apihelp-{$path}-example-simple",
111 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Manage_authentication_data';
116class_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()