OTP : 2FA Authentication
Improve : tighten the security + cosmetic set double authentication : create, send link, usable with Google Authenticator and FreeOTP 1. OTP : prevent direct access without going throught the 2FA mechanism 2. Go back to the url where you were disconnected 3. Cosmetic
This commit is contained in:
parent
4bb0a46e6b
commit
4cee79c1f2
31 changed files with 1867 additions and 270 deletions
|
|
@ -23,6 +23,7 @@ class NoalyssUserTest extends TestCase
|
|||
* @var User
|
||||
*/
|
||||
protected $object;
|
||||
private $cn;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
|
|
@ -239,4 +240,21 @@ class NoalyssUserTest extends TestCase
|
|||
$_SESSION[SESSION_KEY.'use_admin']=1;
|
||||
$user->admin=1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Generate OTP : check key length and uniqueness
|
||||
*/
|
||||
function testGenerateOTP()
|
||||
{
|
||||
$this->object->generate_otp();
|
||||
$secret=$this->object->get_otp_secret();
|
||||
$this->assertTrue(strlen($secret) == 52,"Fails to generate OTP 32 char ".$secret." len = ".strlen($secret));
|
||||
|
||||
for ($i=0;$i<100;$i++){
|
||||
$this->object->generate_otp();
|
||||
$this->assertTrue($secret != $this->object->get_otp_secret(),"Generate twice the same secret");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue