Skip to content

Commit fd4d8a0

Browse files
committed
OXDEV-9078 Add 2FA facade interface
1 parent 8189669 commit fd4d8a0

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Service;
9+
10+
interface TwoFAServiceInterface
11+
{
12+
public function hasPendingChallenge(string $userId): bool;
13+
14+
public function triggerChallenge(string $userId): void;
15+
16+
public function clearChallenge(): void;
17+
}

src/Shared/Model/User.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OxidEsales\Eshop\Core\Exception\InputException;
1313
use OxidEsales\Eshop\Core\Exception\UserException;
1414
use OxidEsales\Eshop\Core\Registry;
15+
// use OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Service\TwoFAServiceInterface;
1516
use OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Service\UserServiceInterface;
1617
use OxidEsales\SecurityModule\Captcha\Captcha\Image\Exception\CaptchaValidateException as ImageCaptchaException;
1718
use OxidEsales\SecurityModule\Captcha\Captcha\HoneyPot\Exception\CaptchaValidateException as HoneyPotCaptchaException;
@@ -107,6 +108,14 @@ protected function onLogin($userName, #[\SensitiveParameter] $password)
107108
}
108109

109110
$userService->handleLogin($userId);
111+
112+
// $settingsService = $this->getService(TwoFASettingsServiceInterface::class);
113+
// if ($settingsService->isTwoFactorAuthEnabled() && !$this->isAdmin()) {
114+
// $authentication = $this->getService(TwoFAServiceInterface::class);
115+
// if ($authentication->hasPendingChallenge($userId)) {
116+
// $authentication->triggerChallenge($userId);
117+
// }
118+
// }
110119
}
111120

112121
private function isCaptchaEnabled(): bool

0 commit comments

Comments
 (0)