MediaWiki REL1_32
|
Utility class for bot passwords. More...
Public Member Functions | |
delete () | |
Delete the BotPassword from the database. | |
getAppId () | |
Get the app ID. | |
getGrants () | |
Get the grants. | |
getRestrictions () | |
Get the restrictions. | |
getToken () | |
Get the token. | |
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 | getDB ( $db) |
Get a database connection for the bot passwords database. | |
static | getSeparator () |
Get the separator for combined user name + app ID. | |
static | invalidateAllPasswordsForCentralId ( $centralId) |
Invalidate all passwords for a user, by central 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=self::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newFromUser (User $user, $appId, $flags=self::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newUnsaved (array $data, $flags=self::READ_NORMAL) |
Create an unsaved BotPassword. | |
static | removeAllPasswordsForCentralId ( $centralId) |
Remove all passwords for a user, by central ID. | |
static | removeAllPasswordsForUser ( $username) |
Remove all passwords for a user, by name. | |
Public Attributes | |
const | APPID_MAXLENGTH = 32 |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = self::READ_LATEST | 2 |
Constants for object loading bitfield flags (higher => higher QoS) | |
const | READ_NONE = -1 |
Protected Member Functions | |
__construct ( $row, $isSaved, $flags=self::READ_NORMAL) | |
getPassword () | |
Get the password. | |
Private Attributes | |
string | $appId |
int | $centralId |
int | $flags = self::READ_NORMAL |
string[] | $grants |
bool | $isSaved |
MWRestrictions | $restrictions |
string | $token |
|
protected |
object | $row | bot_passwords database row |
bool | $isSaved | Whether the bot password was read from the database |
int | $flags | IDBAccessObject read flags |
Definition at line 59 of file BotPassword.php.
References isSaved(), and MWRestrictions\newFromJson().
|
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 419 of file BotPassword.php.
References $username.
BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 318 of file BotPassword.php.
|
static |
Returns a (raw, unhashed) random password string.
Config | $config |
Definition at line 405 of file BotPassword.php.
BotPassword::getAppId | ( | ) |
Get the app ID.
Definition at line 198 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Get a database connection for the bot passwords database.
int | $db | Index of the connection to get, e.g. DB_MASTER or DB_REPLICA. |
Definition at line 75 of file BotPassword.php.
References $wgBotPasswordsCluster, and $wgBotPasswordsDatabase.
BotPassword::getGrants | ( | ) |
Get the grants.
Definition at line 222 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
protected |
Get the password.
Definition at line 239 of file BotPassword.php.
References $options, and list.
Referenced by isInvalid().
BotPassword::getRestrictions | ( | ) |
|
static |
Get the separator for combined user name + app ID.
Definition at line 230 of file BotPassword.php.
References $wgUserrightsInterwikiDelimiter.
BotPassword::getToken | ( | ) |
Get the token.
Definition at line 206 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
BotPassword::getUserCentralId | ( | ) |
Get the central user ID.
Definition at line 190 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Invalidate all passwords for a user, by central ID.
int | $centralId |
Definition at line 350 of file BotPassword.php.
References $wgEnableBotPasswords, and DB_MASTER.
|
static |
Invalidate all passwords for a user, by name.
string | $username | User name |
Definition at line 338 of file BotPassword.php.
References $username.
BotPassword::isInvalid | ( | ) |
Whether the password is currently invalid.
Definition at line 266 of file BotPassword.php.
References getPassword().
BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 182 of file BotPassword.php.
Referenced by __construct(), delete(), and save().
|
static |
Try to log the user in.
string | $username | Combined user name and app ID |
string | $password | Supplied password |
WebRequest | $request |
Definition at line 445 of file BotPassword.php.
References $name, $request, $user, $username, $wgEnableBotPasswords, $wgPasswordAttemptThrottle, list, User\newFromName(), and wfMessage().
|
static |
Load a BotPassword from the database.
int | $centralId | from CentralIdLookup |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 106 of file BotPassword.php.
References $options, $wgEnableBotPasswords, and list.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\refreshSessionInfo().
|
static |
Load a BotPassword from the database.
User | $user | |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 92 of file BotPassword.php.
References $user.
|
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 137 of file BotPassword.php.
References MWRestrictions\newDefault(), and object.
|
static |
Remove all passwords for a user, by central ID.
int | $centralId |
Definition at line 384 of file BotPassword.php.
References $wgEnableBotPasswords, and DB_MASTER.
|
static |
Remove all passwords for a user, by name.
string | $username | User name |
Definition at line 372 of file BotPassword.php.
References $username.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\preventSessionsForUser().
BotPassword::save | ( | $operation, | |
Password | $password = null |
||
) |
Save the BotPassword to the database.
Definition at line 276 of file BotPassword.php.
References DB_MASTER, MWCryptRand\generateHex(), isSaved(), and User\TOKEN_LENGTH.
|
private |
Definition at line 40 of file BotPassword.php.
|
private |
Definition at line 37 of file BotPassword.php.
|
private |
Definition at line 52 of file BotPassword.php.
|
private |
Definition at line 49 of file BotPassword.php.
|
private |
Definition at line 34 of file BotPassword.php.
|
private |
Definition at line 46 of file BotPassword.php.
|
private |
Definition at line 43 of file BotPassword.php.
const BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 31 of file BotPassword.php.