MediaWiki
1.34.0
|
Class representing a two-factor key. More...
Public Member Functions | |
__construct ( $secret, array $scratchTokens) | |
getScratchTokens () | |
getSecret () | |
isScratchToken ( $token) | |
Check if a token is one of the scratch tokens for this two factor key. More... | |
jsonSerialize () | |
regenerateScratchTokens () | |
verify ( $data, OATHUser $user) | |
Static Public Member Functions | |
static | newFromArray (array $data) |
static | newFromRandom () |
static | newFromString ( $data) |
Create key from json encoded string. More... | |
Public Attributes | |
const | MAIN_TOKEN = 1 |
Represents that a token corresponds to the main secret. More... | |
const | SCRATCH_TOKEN = -1 |
Represents that a token corresponds to a scratch token. More... | |
Private Member Functions | |
getLogger () | |
Private Attributes | |
string[] | $scratchTokens = [] |
List of scratch tokens. More... | |
array | $secret |
Two factor binary secret. More... | |
Class representing a two-factor key.
Keys can be tied to OATHUsers
Definition at line 41 of file TOTPKey.php.
MediaWiki\Extension\OATHAuth\Key\TOTPKey::__construct | ( | $secret, | |
array | $scratchTokens | ||
) |
string | $secret | |
array | $scratchTokens |
Definition at line 104 of file TOTPKey.php.
References MediaWiki\Extension\OATHAuth\Key\TOTPKey\$scratchTokens, and MediaWiki\Extension\OATHAuth\Key\TOTPKey\$secret.
|
private |
Definition at line 252 of file TOTPKey.php.
References MediaWiki\Logger\LoggerFactory\getInstance().
Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().
MediaWiki\Extension\OATHAuth\Key\TOTPKey::getScratchTokens | ( | ) |
Definition at line 125 of file TOTPKey.php.
References MediaWiki\Extension\OATHAuth\Key\TOTPKey\$scratchTokens.
Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getScratchTokensForDisplay(), and MediaWiki\Extension\OATHAuth\Key\TOTPKey\jsonSerialize().
MediaWiki\Extension\OATHAuth\Key\TOTPKey::getSecret | ( | ) |
Definition at line 118 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getSecretForDisplay(), and MediaWiki\Extension\OATHAuth\Key\TOTPKey\jsonSerialize().
MediaWiki\Extension\OATHAuth\Key\TOTPKey::isScratchToken | ( | $token | ) |
Check if a token is one of the scratch tokens for this two factor key.
string | $token | Token to verify |
Definition at line 244 of file TOTPKey.php.
MediaWiki\Extension\OATHAuth\Key\TOTPKey::jsonSerialize | ( | ) |
Definition at line 256 of file TOTPKey.php.
References MediaWiki\Extension\OATHAuth\Key\TOTPKey\getScratchTokens(), and MediaWiki\Extension\OATHAuth\Key\TOTPKey\getSecret().
|
static |
array | $data |
Definition at line 93 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors(), MediaWiki\Extension\OATHAuth\Module\TOTP\newKey(), and MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\onSubmit().
|
static |
Exception |
Definition at line 64 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors().
|
static |
Create key from json encoded string.
string | $data |
Definition at line 81 of file TOTPKey.php.
MediaWiki\Extension\OATHAuth\Key\TOTPKey::regenerateScratchTokens | ( | ) |
Definition at line 229 of file TOTPKey.php.
References MediaWiki\Extension\OATHAuth\Key\TOTPKey\$scratchTokens.
MediaWiki\Extension\OATHAuth\Key\TOTPKey::verify | ( | $data, | |
OATHUser | $user | ||
) |
array | $data | |
OATHUser | $user |
MWException |
Implements MediaWiki\Extension\OATHAuth\IAuthKey.
Definition at line 135 of file TOTPKey.php.
References MediaWiki\Extension\OATHAuth\OATHUser\addKey(), CentralIdLookup\factory(), MediaWiki\Extension\OATHAuth\OATHUser\getAccount(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Extension\OATHAuth\Key\TOTPKey\getLogger(), MediaWiki\Extension\OATHAuth\OATHUser\getUser(), MediaWiki\Extension\OATHAuth\Key\TOTPKey\MAIN_TOKEN, MediaWiki\Extension\OATHAuth\Key\TOTPKey\SCRATCH_TOKEN, and MediaWiki\Extension\OATHAuth\OATHUser\setModule().
|
private |
List of scratch tokens.
Definition at line 58 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\__construct(), MediaWiki\Extension\OATHAuth\Key\TOTPKey\getScratchTokens(), and MediaWiki\Extension\OATHAuth\Key\TOTPKey\regenerateScratchTokens().
|
private |
Two factor binary secret.
Definition at line 55 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\__construct().
const MediaWiki\Extension\OATHAuth\Key\TOTPKey::MAIN_TOKEN = 1 |
Represents that a token corresponds to the main secret.
Definition at line 46 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().
const MediaWiki\Extension\OATHAuth\Key\TOTPKey::SCRATCH_TOKEN = -1 |
Represents that a token corresponds to a scratch token.
Definition at line 52 of file TOTPKey.php.
Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().