MediaWiki REL1_35
|
Helper class for AuthManager-using API modules. More...
Public Member Functions | |
__construct (ApiBase $module, AuthManager $authManager=null) | |
formatAuthenticationResponse (AuthenticationResponse $res) | |
Format an AuthenticationResponse for return. | |
formatRequests (array $reqs) | |
Format an array of AuthenticationRequests for return. | |
getPreservedRequest () | |
Fetch the preserved CreateFromLoginAuthenticationRequest, if any. | |
loadAuthenticationRequests ( $action) | |
Fetch and load the AuthenticationRequests for an action. | |
logAuthenticationResult ( $event, $result) | |
Logs successful or failed authentication. | |
securitySensitiveOperation ( $operation) | |
Call $manager->securitySensitiveOperationStatus() | |
Static Public Member Functions | |
static | blacklistAuthenticationRequests (array $reqs, array $blacklist) |
Filter out authentication requests by class name. | |
static | getStandardParams ( $action,... $wantedParams) |
Fetch the standard parameters this helper recognizes. | |
static | newForModule (ApiBase $module, AuthManager $authManager=null) |
Static version of the constructor, for chaining. | |
Private Member Functions | |
formatFields (array $fields) | |
Clean up a field array for output. | |
formatMessage (array &$res, $key, Message $message) | |
Format a message for output. | |
Private Attributes | |
AuthManager | $authManager |
string | $messageFormat |
Message output format. | |
ApiBase | $module |
API module, for context and parameters. | |
Helper class for AuthManager-using API modules.
Intended for use via composition.
Definition at line 37 of file ApiAuthManagerHelper.php.
ApiAuthManagerHelper::__construct | ( | ApiBase | $module, |
AuthManager | $authManager = null |
||
) |
ApiBase | $module | API module, for context and parameters |
AuthManager | null | $authManager |
Definition at line 52 of file ApiAuthManagerHelper.php.
References $authManager, $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 129 of file ApiAuthManagerHelper.php.
Referenced by ApiChangeAuthenticationData\execute(), ApiClientLogin\execute(), and ApiQueryAuthManagerInfo\execute().
ApiAuthManagerHelper::formatAuthenticationResponse | ( | AuthenticationResponse | $res | ) |
Format an AuthenticationResponse for return.
AuthenticationResponse | $res |
Definition at line 194 of file ApiAuthManagerHelper.php.
References $res, 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 325 of file ApiAuthManagerHelper.php.
References $module, and formatMessage().
Referenced by formatRequests().
|
private |
Format a message for output.
array | &$res | Result array |
string | $key | Result key |
Message | $message |
Definition at line 76 of file ApiAuthManagerHelper.php.
References $res, Message\getKey(), Message\getParams(), and Message\setContext().
Referenced by formatAuthenticationResponse(), formatFields(), and formatRequests().
ApiAuthManagerHelper::formatRequests | ( | array | $reqs | ) |
Format an array of AuthenticationRequests for return.
AuthenticationRequest[] | $reqs |
Definition at line 279 of file ApiAuthManagerHelper.php.
References formatFields(), and formatMessage().
Referenced by formatAuthenticationResponse().
ApiAuthManagerHelper::getPreservedRequest | ( | ) |
Fetch the preserved CreateFromLoginAuthenticationRequest, if any.
Definition at line 268 of file ApiAuthManagerHelper.php.
|
static |
Fetch the standard parameters this helper recognizes.
string | $action | AuthManager action |
string | ...$wantedParams Parameters to use |
Definition at line 362 of file ApiAuthManagerHelper.php.
Referenced by ApiAMCreateAccount\getAllowedParams(), ApiChangeAuthenticationData\getAllowedParams(), ApiClientLogin\getAllowedParams(), ApiLinkAccount\getAllowedParams(), ApiQueryAuthManagerInfo\getAllowedParams(), and ApiRemoveAuthenticationData\getAllowedParams().
ApiAuthManagerHelper::loadAuthenticationRequests | ( | $action | ) |
Fetch and load the AuthenticationRequests for an action.
string | $action | One of the AuthManager::ACTION_* constants |
Definition at line 144 of file ApiAuthManagerHelper.php.
References MediaWiki\Auth\AuthenticationRequest\getUniqueId(), and 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 245 of file ApiAuthManagerHelper.php.
References $module, and ApiBase\getModuleName().
|
static |
Static version of the constructor, for chaining.
ApiBase | $module | API module, for context and parameters |
AuthManager | null | $authManager |
Definition at line 66 of file ApiAuthManagerHelper.php.
References $authManager, and $module.
Referenced by ApiRemoveAuthenticationData\execute().
ApiAuthManagerHelper::securitySensitiveOperation | ( | $operation | ) |
Call $manager->securitySensitiveOperationStatus()
string | $operation | Operation being checked. |
ApiUsageException |
Definition at line 106 of file ApiAuthManagerHelper.php.
|
private |
Definition at line 46 of file ApiAuthManagerHelper.php.
Referenced by __construct(), and newForModule().
|
private |
Message output format.
Definition at line 43 of file ApiAuthManagerHelper.php.
|
private |
API module, for context and parameters.
Definition at line 40 of file ApiAuthManagerHelper.php.
Referenced by __construct(), formatFields(), logAuthenticationResult(), and newForModule().