Skip to content
Permalink
Browse files

Merge branch '8.next'

  • Loading branch information...
steinkel committed Mar 14, 2019
2 parents 3f817d9 + 0c4a009 commit 454d38973c7506d2a277ce2a9e107355ff28aa0a
@@ -432,4 +432,14 @@ protected function getTwoFactorAuthenticationChecker()
{
return (new TwoFactorAuthenticationCheckerFactory())->build();
}
/**
* Get the configured two factory authentication
*
* @return \CakeDC\Users\Auth\U2fAuthenticationCheckerInterface
*/
protected function getU2fAuthenticationChecker()
{
return (new U2fAuthenticationCheckerFactory())->build();
}
}
@@ -10,7 +10,6 @@
*/
namespace CakeDC\Users\Controller\Traits;
use CakeDC\Users\Auth\U2fAuthenticationCheckerFactory;
use u2flib_server\U2F;
/**
@@ -212,14 +211,4 @@ protected function getU2fData()
return $data;
}
/**
* Get the configured two factory authentication
*
* @return \CakeDC\Users\Auth\U2fAuthenticationCheckerInterface
*/
protected function getU2fAuthenticationChecker()
{
return (new U2fAuthenticationCheckerFactory())->build();
}
}
@@ -11,7 +11,6 @@
namespace CakeDC\Users\Test\TestCase\Controller\Traits;
use CakeDC\Users\Auth\DefaultU2fAuthenticationChecker;
use CakeDC\Users\Controller\Component\GoogleAuthenticatorComponent;
use CakeDC\Users\Controller\Component\UsersAuthComponent;
use CakeDC\Users\Controller\Traits\LoginTrait;
@@ -41,11 +40,8 @@ public function setUp()
parent::setUp();
$request = new ServerRequest();
$this->Trait = $this->getMockBuilder('CakeDC\Users\Controller\Traits\LoginTrait')
->setMethods(['dispatchEvent', 'redirect', 'set', 'getU2fAuthenticationChecker'])
->setMethods(['dispatchEvent', 'redirect', 'set'])
->getMockForTrait();
$this->Trait->expects($this->any())
->method('getU2fAuthenticationChecker')
->will($this->returnValue(new DefaultU2fAuthenticationChecker()));
$this->Trait->Auth = $this->getMockBuilder('Cake\Controller\Component\AuthComponent')
->setMethods(['setConfig'])
@@ -11,6 +11,7 @@
namespace CakeDC\Users\Test\TestCase\Controller\Traits;
use CakeDC\Users\Auth\DefaultU2fAuthenticationChecker;
use Cake\Core\Configure;
use Cake\Http\Response;
use Cake\Http\ServerRequest;
@@ -42,14 +43,17 @@ class U2fTraitTest extends BaseTraitTest
public function setUp()
{
$this->traitClassName = 'CakeDC\Users\Controller\Traits\U2fTrait';
$this->traitMockMethods = ['dispatchEvent', 'isStopped', 'redirect', 'getUsersTable', 'set', 'createU2fLib', 'getData'];
$this->traitMockMethods = ['dispatchEvent', 'isStopped', 'redirect', 'getUsersTable', 'set', 'createU2fLib', 'getData', 'getU2fAuthenticationChecker'];
parent::setUp();
$this->Trait->Auth = $this->getMockBuilder('Cake\Controller\Component\AuthComponent')
->setMethods(['setConfig', 'redirectUrl', 'setUser'])
->disableOriginalConstructor()
->getMock();
$this->Trait->expects($this->any())
->method('getU2fAuthenticationChecker')
->willReturn(new DefaultU2fAuthenticationChecker());
$request = new ServerRequest();
$this->Trait->request = $request;

0 comments on commit 454d389

Please sign in to comment.
You can’t perform that action at this time.