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 (UserIdentity $userIdentity, $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 33 of file BotPassword.php.
◆ __construct()
BotPassword::__construct |
( |
|
$row, |
|
|
|
$isSaved, |
|
|
|
$flags = self::READ_NORMAL |
|
) |
| |
- Access: internal
- only public for construction in BotPasswordStore
- Parameters
-
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 82 of file BotPassword.php.
References isSaved().
◆ 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
- string[]|false
Definition at line 378 of file BotPassword.php.
◆ delete()
◆ generatePassword()
static BotPassword::generatePassword |
( |
|
$config | ) |
|
|
static |
Returns a (raw, unhashed) random password string.
- Parameters
-
- Returns
- string
Definition at line 364 of file BotPassword.php.
◆ getAppId()
BotPassword::getAppId |
( |
| ) |
|
◆ getDB()
static BotPassword::getDB |
( |
|
$db | ) |
|
|
static |
Get a database connection for the bot passwords database.
- Parameters
-
int | $db | Index of the connection to get, e.g. DB_PRIMARY or DB_REPLICA. |
- Returns
- IDatabase
Definition at line 98 of file BotPassword.php.
◆ getGrants()
BotPassword::getGrants |
( |
| ) |
|
◆ getPassword()
BotPassword::getPassword |
( |
| ) |
|
|
private |
◆ 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 289 of file BotPassword.php.
◆ 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 489 of file BotPassword.php.
References Status\getMessage(), and StatusValue\isGood().
◆ newFromCentralId()
static BotPassword::newFromCentralId |
( |
|
$centralId, |
|
|
|
$appId, |
|
|
|
$flags = self::READ_NORMAL |
|
) |
| |
|
static |
◆ newFromUser()
static BotPassword::newFromUser |
( |
UserIdentity |
$userIdentity, |
|
|
|
$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: (UserIdentity) UserIdentity 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, required) App ID for the password.
- restrictions: (MWRestrictions, optional) Restrictions.
- grants: (string[], optional) Grants.
|
int | $flags | IDBAccessObject read flags |
- Returns
- BotPassword|null
Definition at line 142 of file BotPassword.php.
◆ removeAllPasswordsForCentralId()
static BotPassword::removeAllPasswordsForCentralId |
( |
|
$centralId | ) |
|
|
static |
◆ removeAllPasswordsForUser()
static BotPassword::removeAllPasswordsForUser |
( |
|
$username | ) |
|
|
static |
Remove all passwords for a user, by name.
- Parameters
-
- Returns
- bool Whether any passwords were removed
Definition at line 327 of file BotPassword.php.
◆ save()
BotPassword::save |
( |
|
$operation, |
|
|
Password |
$password = null |
|
) |
| |
◆ $appId
string BotPassword::$appId |
|
private |
◆ $centralId
int BotPassword::$centralId |
|
private |
◆ $flags
◆ $grants
string [] BotPassword::$grants |
|
private |
◆ $isSaved
bool BotPassword::$isSaved |
|
private |
◆ $restrictions
◆ $token
string BotPassword::$token |
|
private |
◆ APPID_MAXLENGTH
const BotPassword::APPID_MAXLENGTH = 32 |
◆ GRANTS_MAXLENGTH
const BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
- Since
- 1.36
Definition at line 52 of file BotPassword.php.
◆ PASSWORD_MINLENGTH
const BotPassword::PASSWORD_MINLENGTH = 32 |
◆ RESTRICTIONS_MAXLENGTH
const BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
- Since
- 1.36
Definition at line 46 of file BotPassword.php.
The documentation for this class was generated from the following file: