Skip to content

Commit

Permalink
Merge pull request #1017 from rochamarcelo/feature/correctly-load-web…
Browse files Browse the repository at this point in the history
…authn

Correcly load classed for webauthn
  • Loading branch information
rochamarcelo authored Jan 16, 2023
2 parents 1aafd0b + 6870345 commit 47897d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Loader/AuthenticationServiceLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected function loadTwoFactorAuthenticator($service)
{
if (
Configure::read('OneTimePasswordAuthenticator.login') !== false
|| Configure::read('Webauthn2fa.enabled') !== false
|| Configure::read('U2f.enabled') !== false
) {
$service->loadAuthenticator('CakeDC/Auth.TwoFactor', [
Expand Down
1 change: 1 addition & 0 deletions src/Loader/MiddlewareQueueLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected function load2faMiddleware(MiddlewareQueue $middlewareQueue)
{
if (
Configure::read('OneTimePasswordAuthenticator.login') !== false
|| Configure::read('Webauthn2fa.enabled') !== false
|| Configure::read('U2f.enabled') !== false
) {
$middlewareQueue->add(TwoFactorMiddleware::class);
Expand Down
12 changes: 9 additions & 3 deletions tests/TestCase/Provider/AuthenticationServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public function testGetAuthenticationService()
];
$actual = [];
foreach ($authenticators as $key => $value) {
$actual[get_class($value)] = $value->getConfig();
$config = $value->getConfig();
unset($config['impersonateSessionKey']);
$actual[get_class($value)] = $config;
}
$this->assertEquals($expected, $actual);

Expand Down Expand Up @@ -144,7 +146,9 @@ public function testGetAuthenticationService()
];
$actual = [];
foreach ($identifiers as $key => $value) {
$actual[get_class($value)] = $value->getConfig();
$config = $value->getConfig();
unset($config['impersonateSessionKey'], $config['hashAlgorithm']);
$actual[get_class($value)] = $config;
}
$this->assertEquals($expected, $actual);
}
Expand Down Expand Up @@ -242,7 +246,9 @@ public function testGetAuthenticationServiceWithoutOneTimePasswordAuthenticator(
];
$actual = [];
foreach ($authenticators as $key => $value) {
$actual[get_class($value)] = $value->getConfig();
$config = $value->getConfig();
unset($config['impersonateSessionKey']);
$actual[get_class($value)] = $config;
}
$this->assertEquals($expected, $actual);
}
Expand Down

0 comments on commit 47897d9

Please sign in to comment.