MediaWiki REL1_31
|
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. | |
regenerateScratchTokens () | |
verifyToken ( $token, OATHUser $user) | |
Verify a token against the secret or scratch tokens. | |
Static Public Member Functions | |
static | newFromRandom () |
Make a new key from random values. | |
Public Attributes | |
const | MAIN_TOKEN = 1 |
Represents that a token corresponds to the main secret. | |
const | SCRATCH_TOKEN = -1 |
Represents that a token corresponds to a scratch token. | |
Private Attributes | |
string[] | $scratchTokens |
List of scratch tokens. | |
array | $secret |
Two factor binary secret. | |
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html Class representing a two-factor key
Keys can be tied to OATHUsers
Definition at line 26 of file OATHAuthKey.php.
OATHAuthKey::__construct | ( | $secret, | |
array | $scratchTokens ) |
string | $secret | |
array | $scratchTokens |
Definition at line 65 of file OATHAuthKey.php.
References $scratchTokens, and $secret.
OATHAuthKey::getScratchTokens | ( | ) |
Definition at line 86 of file OATHAuthKey.php.
References $scratchTokens.
Referenced by SpecialOATHEnable\getScratchTokensForDisplay().
OATHAuthKey::getSecret | ( | ) |
Definition at line 79 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 183 of file OATHAuthKey.php.
|
static |
Make a new key from random values.
Definition at line 50 of file OATHAuthKey.php.
References Base32\encode(), and MWCryptRand\generate().
Referenced by SpecialOATHEnable\getFormFields().
OATHAuthKey::regenerateScratchTokens | ( | ) |
Definition at line 168 of file OATHAuthKey.php.
References $scratchTokens, Base32\encode(), and MWCryptRand\generate().
OATHAuthKey::verifyToken | ( | $token, | |
OATHUser | $user ) |
Verify a token against the secret or scratch tokens.
string | $token | Token to verify |
OATHUser | $user |
Definition at line 99 of file OATHAuthKey.php.
References $retval, Base32\decode(), HOTP\generateByTimeWindow(), OATHAuthHooks\getOATHUserRepository(), MAIN_TOKEN, SCRATCH_TOKEN, and wfMemcKey().
|
private |
List of scratch tokens.
Definition at line 43 of file OATHAuthKey.php.
Referenced by __construct(), getScratchTokens(), and regenerateScratchTokens().
|
private |
Two factor binary secret.
Definition at line 40 of file OATHAuthKey.php.
Referenced by __construct().
const OATHAuthKey::MAIN_TOKEN = 1 |
Represents that a token corresponds to the main secret.
Definition at line 31 of file OATHAuthKey.php.
Referenced by verifyToken().
const OATHAuthKey::SCRATCH_TOKEN = -1 |
Represents that a token corresponds to a scratch token.
Definition at line 37 of file OATHAuthKey.php.
Referenced by verifyToken().