MediaWiki
1.33.1
|
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... | |
regenerateScratchTokens () | |
verifyToken ( $token, OATHUser $user) | |
Verify a token against the secret or scratch tokens. More... | |
Static Public Member Functions | |
static | newFromRandom () |
Make a new key from random values. 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 29 of file OATHAuthKey.php.
OATHAuthKey::__construct | ( | $secret, | |
array | $scratchTokens | ||
) |
string | $secret | |
array | $scratchTokens |
Definition at line 68 of file OATHAuthKey.php.
References $scratchTokens, and $secret.
|
private |
OATHAuthKey::getScratchTokens | ( | ) |
Definition at line 89 of file OATHAuthKey.php.
References $scratchTokens.
Referenced by SpecialOATHEnable\getScratchTokensForDisplay().
OATHAuthKey::getSecret | ( | ) |
Definition at line 82 of file OATHAuthKey.php.
Referenced by SpecialOATHEnable\getSecretForDisplay().
OATHAuthKey::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 207 of file OATHAuthKey.php.
|
static |
Make a new key from random values.
Definition at line 53 of file OATHAuthKey.php.
References Base32\encode().
Referenced by SpecialOATHEnable\getFormFields().
OATHAuthKey::regenerateScratchTokens | ( | ) |
Definition at line 192 of file OATHAuthKey.php.
References $scratchTokens, and Base32\encode().
OATHAuthKey::verifyToken | ( | $token, | |
OATHUser | $user | ||
) |
Verify a token against the secret or scratch tokens.
string | $token | Token to verify |
OATHUser | $user |
Definition at line 102 of file OATHAuthKey.php.
References $user, as, captcha-old\count, Base32\decode(), CentralIdLookup\factory(), HOTP\generateByTimeWindow(), getLogger(), OATHAuthHooks\getOATHUserRepository(), MAIN_TOKEN, ObjectCache\newAnything(), SCRATCH_TOKEN, and wfMemcKey().
|
private |
List of scratch tokens.
Definition at line 46 of file OATHAuthKey.php.
Referenced by __construct(), getScratchTokens(), and regenerateScratchTokens().
|
private |
Two factor binary secret.
Definition at line 43 of file OATHAuthKey.php.
Referenced by __construct().
const OATHAuthKey::MAIN_TOKEN = 1 |
Represents that a token corresponds to the main secret.
Definition at line 34 of file OATHAuthKey.php.
Referenced by verifyToken().
const OATHAuthKey::SCRATCH_TOKEN = -1 |
Represents that a token corresponds to a scratch token.
Definition at line 40 of file OATHAuthKey.php.
Referenced by verifyToken().