34 $maxage =
$params[
'maxtokenage'];
44 $this->
addWarning(
'apiwarn-checktoken-percentencoding' );
47 if ( $tokenObj->match( $token, $maxage ) ) {
48 $res[
'result'] =
'valid';
49 }
elseif ( $maxage !==
null && $tokenObj->match( $token ) ) {
50 $res[
'result'] =
'expired';
52 $res[
'result'] =
'invalid';
55 $ts = Token::getTimestamp( $token );
58 $mwts->timestamp->setTimestamp( $ts );
59 $res[
'generated'] = $mwts->getTimestamp( TS_ISO_8601 );
84 'action=checktoken&type=csrf&token=123ABC'
85 =>
'apihelp-checktoken-example-simple',
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_SENSITIVE
(boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of ...
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
getModuleName()
Get the name of the module being executed by this instance.
getExamplesMessages()
Returns usage examples for this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
static getTokenTypeSalts()
Get the salts for known token types.
static getToken(User $user, MediaWiki\Session\Session $session, $salt)
Get a token from a salt.
Library for creating and parsing MW-style timestamps.