MediaWiki
1.34.0
|
Helper class for AuthManager-using API modules. More...
Public Member Functions | |
__construct (ApiBase $module) | |
formatAuthenticationResponse (AuthenticationResponse $res) | |
Format an AuthenticationResponse for return. More... | |
formatRequests (array $reqs) | |
Format an array of AuthenticationRequests for return. More... | |
getPreservedRequest () | |
Fetch the preserved CreateFromLoginAuthenticationRequest, if any. More... | |
loadAuthenticationRequests ( $action) | |
Fetch and load the AuthenticationRequests for an action. More... | |
logAuthenticationResult ( $event, $result) | |
Logs successful or failed authentication. More... | |
securitySensitiveOperation ( $operation) | |
Call $manager->securitySensitiveOperationStatus() More... | |
Static Public Member Functions | |
static | blacklistAuthenticationRequests (array $reqs, array $blacklist) |
Filter out authentication requests by class name. More... | |
static | getStandardParams ( $action,... $wantedParams) |
Fetch the standard parameters this helper recognizes. More... | |
static | newForModule (ApiBase $module) |
Static version of the constructor, for chaining. More... | |
Private Member Functions | |
formatFields (array $fields) | |
Clean up a field array for output. More... | |
formatMessage (array &$res, $key, Message $message) | |
Format a message for output. More... | |
Private Attributes | |
string | $messageFormat |
Message output format. More... | |
ApiBase | $module |
API module, for context and parameters. More... | |
Helper class for AuthManager-using API modules.
Intended for use via composition.
Definition at line 36 of file ApiAuthManagerHelper.php.
ApiAuthManagerHelper::__construct | ( | ApiBase | $module | ) |
ApiBase | $module | API module, for context and parameters |
Definition at line 47 of file ApiAuthManagerHelper.php.
References $module, and ApiBase\extractRequestParams().
|
static |
Filter out authentication requests by class name.
AuthenticationRequest[] | $reqs | Requests to filter |
string[] | $blacklist | Class names to remove |
Definition at line 121 of file ApiAuthManagerHelper.php.
Referenced by ApiChangeAuthenticationData\execute(), ApiQueryAuthManagerInfo\execute(), and ApiClientLogin\execute().
ApiAuthManagerHelper::formatAuthenticationResponse | ( | AuthenticationResponse | $res | ) |
Format an AuthenticationResponse for return.
AuthenticationResponse | $res |
Definition at line 184 of file ApiAuthManagerHelper.php.
References $res, ApiMessage\create(), formatMessage(), and formatRequests().
|
private |
Clean up a field array for output.
array | $fields | -param array{type:string,options:array,value:string,label:Message,help:Message,optional:bool,sensitive:bool,skippable:bool} $fields |
Definition at line 315 of file ApiAuthManagerHelper.php.
References $module, formatMessage(), and ApiResult\setArrayType().
Referenced by formatRequests().
|
private |
Format a message for output.
array | &$res | Result array |
string | $key | Result key |
Message | $message |
Definition at line 69 of file ApiAuthManagerHelper.php.
References $res, and ApiResult\setIndexedTagName().
Referenced by formatAuthenticationResponse(), formatFields(), and formatRequests().
ApiAuthManagerHelper::formatRequests | ( | array | $reqs | ) |
Format an array of AuthenticationRequests for return.
AuthenticationRequest[] | $reqs |
Definition at line 269 of file ApiAuthManagerHelper.php.
References formatFields(), formatMessage(), and ApiResult\META_TYPE.
Referenced by formatAuthenticationResponse().
ApiAuthManagerHelper::getPreservedRequest | ( | ) |
Fetch the preserved CreateFromLoginAuthenticationRequest, if any.
Definition at line 258 of file ApiAuthManagerHelper.php.
|
static |
Fetch the standard parameters this helper recognizes.
string | $action | AuthManager action |
string | ...$wantedParams Parameters to use |
Definition at line 352 of file ApiAuthManagerHelper.php.
References ApiBase\PARAM_DFLT, ApiBase\PARAM_HELP_MSG, ApiBase\PARAM_ISMULTI, ApiBase\PARAM_REQUIRED, and ApiBase\PARAM_TYPE.
Referenced by ApiChangeAuthenticationData\getAllowedParams(), ApiRemoveAuthenticationData\getAllowedParams(), ApiQueryAuthManagerInfo\getAllowedParams(), ApiLinkAccount\getAllowedParams(), ApiAMCreateAccount\getAllowedParams(), and ApiClientLogin\getAllowedParams().
ApiAuthManagerHelper::loadAuthenticationRequests | ( | $action | ) |
Fetch and load the AuthenticationRequests for an action.
string | $action | One of the AuthManager::ACTION_* constants |
Definition at line 136 of file ApiAuthManagerHelper.php.
References true.
ApiAuthManagerHelper::logAuthenticationResult | ( | $event, | |
$result | |||
) |
Logs successful or failed authentication.
string | $event | Event type (e.g. 'accountcreation') |
string | AuthenticationResponse | $result | Response or error message |
Definition at line 235 of file ApiAuthManagerHelper.php.
References $module, $status, ApiBase\getModuleName(), StatusValue\newFatal(), and StatusValue\newGood().
|
static |
Static version of the constructor, for chaining.
ApiBase | $module | API module, for context and parameters |
Definition at line 59 of file ApiAuthManagerHelper.php.
References $module.
Referenced by ApiRemoveAuthenticationData\execute().
ApiAuthManagerHelper::securitySensitiveOperation | ( | $operation | ) |
Call $manager->securitySensitiveOperationStatus()
string | $operation | Operation being checked. |
ApiUsageException |
Definition at line 98 of file ApiAuthManagerHelper.php.
References $status.
|
private |
Message output format.
Definition at line 42 of file ApiAuthManagerHelper.php.
|
private |
API module, for context and parameters.
Definition at line 39 of file ApiAuthManagerHelper.php.
Referenced by __construct(), formatFields(), logAuthenticationResult(), and newForModule().