Beispiel #1
0
 public function testAuthentication()
 {
     $provider = new TotpAuth($this->container);
     $secret = $provider->getSecret();
     $this->assertNotEmpty($secret);
     $provider->setCode('1234');
     $this->assertFalse($provider->authenticate());
     if (!!`which oathtool`) {
         $code = shell_exec('oathtool --totp -b ' . $secret);
         $provider->setCode(trim($code));
         $this->assertTrue($provider->authenticate());
     }
 }
 public function testSetSecret()
 {
     $provider = new TotpAuth($this->container);
     $provider->setSecret('mySecret');
     $this->assertEquals('mySecret', $provider->getSecret());
 }