Utility class for bot passwords.
More...
|
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.
|
|
|
static | loginHook ( $user, $bp, Status $status) |
| Call AuthManagerLoginAuthenticateAudit.
|
|
Utility class for bot passwords.
- Since
- 1.27
Definition at line 30 of file BotPassword.php.
◆ __construct()
BotPassword::__construct |
( |
| $row, |
|
|
| $isSaved, |
|
|
| $flags = self::READ_NORMAL ) |
|
protected |
◆ canonicalizeLoginData()
static BotPassword::canonicalizeLoginData |
( |
| $username, |
|
|
| $password ) |
|
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.
- Parameters
-
string | $username | |
string | $password | |
- Returns
- array|false
Definition at line 420 of file BotPassword.php.
References $username, and and().
◆ delete()
◆ generatePassword()
static BotPassword::generatePassword |
( |
| $config | ) |
|
|
static |
Returns a (raw, unhashed) random password string.
- Parameters
-
- Returns
- string
Definition at line 406 of file BotPassword.php.
References and().
◆ getAppId()
BotPassword::getAppId |
( |
| ) |
|
◆ getDB()
static BotPassword::getDB |
( |
| $db | ) |
|
|
static |
◆ getGrants()
BotPassword::getGrants |
( |
| ) |
|
◆ getPassword()
BotPassword::getPassword |
( |
| ) |
|
|
protected |
◆ getRestrictions()
BotPassword::getRestrictions |
( |
| ) |
|
◆ getSeparator()
static BotPassword::getSeparator |
( |
| ) |
|
|
static |
◆ getToken()
BotPassword::getToken |
( |
| ) |
|
◆ getUserCentralId()
BotPassword::getUserCentralId |
( |
| ) |
|
◆ invalidateAllPasswordsForCentralId()
static BotPassword::invalidateAllPasswordsForCentralId |
( |
| $centralId | ) |
|
|
static |
◆ invalidateAllPasswordsForUser()
static BotPassword::invalidateAllPasswordsForUser |
( |
| $username | ) |
|
|
static |
Invalidate all passwords for a user, by name.
- Parameters
-
- Returns
- bool Whether any passwords were invalidated
Definition at line 339 of file BotPassword.php.
References $username.
◆ isInvalid()
BotPassword::isInvalid |
( |
| ) |
|
◆ isSaved()
◆ login()
static BotPassword::login |
( |
| $username, |
|
|
| $password, |
|
|
WebRequest | $request ) |
|
static |
◆ loginHook()
static BotPassword::loginHook |
( |
| $user, |
|
|
| $bp, |
|
|
Status | $status ) |
|
staticprivate |
Call AuthManagerLoginAuthenticateAudit.
To facilitate logging all authentications, even ones not via AuthManager, call the AuthManagerLoginAuthenticateAudit hook.
- Parameters
-
User | string | $user | User being logged in |
BotPassword | null | $bp | Bot sub-account, if it can be identified |
Status | $status | Login status |
- Returns
- Status The passed-in status
Definition at line 531 of file BotPassword.php.
References $extraData, $response, and $user.
◆ newFromCentralId()
static BotPassword::newFromCentralId |
( |
| $centralId, |
|
|
| $appId, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
◆ newFromUser()
static BotPassword::newFromUser |
( |
User | $user, |
|
|
| $appId, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
◆ newUnsaved()
static BotPassword::newUnsaved |
( |
array | $data, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
Create an unsaved BotPassword.
- Parameters
-
array | $data | Data to use to create the bot password. Keys are:
- user: (User) User object to create the password for. Overrides username and centralId.
- username: (string) Username to create the password for. Overrides centralId.
- centralId: (int) User central ID to create the password for.
- appId: (string) App ID for the password.
- restrictions: (MWRestrictions, optional) Restrictions.
- grants: (string[], optional) Grants.
|
int | $flags | IDBAccessObject read flags |
- Returns
- BotPassword|null
Definition at line 138 of file BotPassword.php.
References $data, and(), MWRestrictions\newDefault(), and object.
◆ removeAllPasswordsForCentralId()
static BotPassword::removeAllPasswordsForCentralId |
( |
| $centralId | ) |
|
|
static |
◆ removeAllPasswordsForUser()
static BotPassword::removeAllPasswordsForUser |
( |
| $username | ) |
|
|
static |
◆ save()
◆ $appId
string BotPassword::$appId |
|
private |
◆ $centralId
int BotPassword::$centralId |
|
private |
◆ $flags
int BotPassword::$flags = self::READ_NORMAL |
|
private |
◆ $grants
string [] BotPassword::$grants |
|
private |
◆ $isSaved
bool BotPassword::$isSaved |
|
private |
◆ $restrictions
◆ $token
string BotPassword::$token |
|
private |
◆ APPID_MAXLENGTH
const BotPassword::APPID_MAXLENGTH = 32 |
The documentation for this class was generated from the following file: