MediaWiki master
|
Utility class for bot passwords. More...
Public Member Functions | |
__construct ( $row, $isSaved, $flags=IDBAccessObject::READ_NORMAL) | |
delete () | |
Delete the BotPassword from the database. | |
getAppId () | |
getGrants () | |
getRestrictions () | |
getToken () | |
getUserCentralId () | |
Get the central user ID. | |
isInvalid () | |
Whether the password is currently invalid. | |
isSaved () | |
Indicate whether this is known to be saved. | |
save ( $operation, Password $password=null) | |
Save the BotPassword to the database. | |
Static Public Member Functions | |
static | canonicalizeLoginData ( $username, $password) |
There are two ways to login with a bot password: "username@appId", "password" and "username", "appId@password". | |
static | generatePassword ( $config) |
Returns a (raw, unhashed) random password string. | |
static | getPrimaryDatabase () |
static | getReplicaDatabase () |
static | getSeparator () |
Get the separator for combined username + app ID. | |
static | invalidateAllPasswordsForUser ( $username) |
Invalidate all passwords for a user, by name. | |
static | login ( $username, $password, WebRequest $request) |
Try to log the user in. | |
static | newFromCentralId ( $centralId, $appId, $flags=IDBAccessObject::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newFromUser (UserIdentity $userIdentity, $appId, $flags=IDBAccessObject::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newUnsaved (array $data, $flags=IDBAccessObject::READ_NORMAL) |
Create an unsaved BotPassword. | |
static | removeAllPasswordsForUser ( $username) |
Remove all passwords for a user, by name. | |
Public Attributes | |
const | APPID_MAXLENGTH = 32 |
const | GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants. | |
const | PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password. | |
const | RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions. | |
MediaWiki\User\BotPassword::__construct | ( | $row, | |
$isSaved, | |||
$flags = IDBAccessObject::READ_NORMAL ) |
stdClass | $row | bot_passwords database row |
bool | $isSaved | Whether the bot password was read from the database |
int | $flags | IDBAccessObject read flags |
Definition at line 98 of file BotPassword.php.
References MediaWiki\User\BotPassword\isSaved().
|
static |
There are two ways to login with a bot password: "username@appId", "password" and "username", "appId@password".
Transform it so it is always in the first form. Returns [bot username, bot password]. If this cannot be a bot password login just return false.
string | $username | |
string | $password |
Definition at line 345 of file BotPassword.php.
Referenced by MediaWiki\Api\ApiLogin\execute().
MediaWiki\User\BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 294 of file BotPassword.php.
|
static |
Returns a (raw, unhashed) random password string.
Config | $config |
Definition at line 332 of file BotPassword.php.
MediaWiki\User\BotPassword::getAppId | ( | ) |
Definition at line 184 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
MediaWiki\User\BotPassword::getGrants | ( | ) |
Definition at line 205 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Definition at line 115 of file BotPassword.php.
|
static |
Definition at line 109 of file BotPassword.php.
MediaWiki\User\BotPassword::getRestrictions | ( | ) |
Definition at line 198 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Get the separator for combined username + app ID.
Definition at line 213 of file BotPassword.php.
MediaWiki\User\BotPassword::getToken | ( | ) |
Definition at line 191 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
MediaWiki\User\BotPassword::getUserCentralId | ( | ) |
Get the central user ID.
Definition at line 177 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Invalidate all passwords for a user, by name.
string | $username |
Definition at line 310 of file BotPassword.php.
MediaWiki\User\BotPassword::isInvalid | ( | ) |
Whether the password is currently invalid.
Definition at line 252 of file BotPassword.php.
MediaWiki\User\BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 169 of file BotPassword.php.
Referenced by MediaWiki\User\BotPassword\__construct().
|
static |
Try to log the user in.
string | $username | Combined user name and app ID |
string | $password | Supplied password |
WebRequest | $request |
Definition at line 371 of file BotPassword.php.
References MediaWiki\Request\WebRequest\getIP(), MediaWiki\Request\WebRequest\getSession(), and wfMessage().
Referenced by MediaWiki\Api\ApiLogin\execute().
|
static |
Load a BotPassword from the database.
int | $centralId | from CentralIdLookup |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 141 of file BotPassword.php.
|
static |
Load a BotPassword from the database.
UserIdentity | $userIdentity | |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 128 of file BotPassword.php.
|
static |
Create an unsaved BotPassword.
array | $data | Data to use to create the bot password. Keys are:
|
int | $flags | IDBAccessObject read flags |
Definition at line 159 of file BotPassword.php.
|
static |
Remove all passwords for a user, by name.
string | $username |
Definition at line 321 of file BotPassword.php.
MediaWiki\User\BotPassword::save | ( | $operation, | |
Password | $password = null ) |
Save the BotPassword to the database.
string | $operation | 'update' or 'insert' |
Password | null | $password | Password to set. |
UnexpectedValueException |
Definition at line 263 of file BotPassword.php.
const MediaWiki\User\BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 51 of file BotPassword.php.
const MediaWiki\User\BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
Definition at line 68 of file BotPassword.php.
const MediaWiki\User\BotPassword::PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password.
Definition at line 56 of file BotPassword.php.
const MediaWiki\User\BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
Definition at line 62 of file BotPassword.php.