improve code

This commit is contained in:
Daniel Seifert 2022-12-13 22:24:33 +01:00
parent 4183ebcf99
commit 68b9f53c14
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
81 changed files with 271 additions and 218 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea .idea
.php_cs.cache
src/tests/.phpunit.result.cache src/tests/.phpunit.result.cache
src/tests/reports/ src/tests/reports/

13
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP74Migration' => true,
'@PSR12' => true
])
->setFinder($finder)
;

View File

@ -39,6 +39,7 @@
"ext-json": "*" "ext-json": "*"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.19",
"phpstan/phpstan": "^1.8" "phpstan/phpstan": "^1.8"
}, },
"autoload": { "autoload": {

View File

@ -78,7 +78,7 @@ class d3user_webauthn extends AdminDetailsController
public function requestNewCredential(): void public function requestNewCredential(): void
{ {
try { try {
$this->setPageType( 'requestnew' ); $this->setPageType('requestnew');
$this->setAuthnRegister(); $this->setAuthnRegister();
} catch (Exception|ContainerExceptionInterface|NotFoundExceptionInterface|DoctrineDriverException $e) { } catch (Exception|ContainerExceptionInterface|NotFoundExceptionInterface|DoctrineDriverException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e->getMessage()); $this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e->getMessage());
@ -97,16 +97,16 @@ class d3user_webauthn extends AdminDetailsController
{ {
try { try {
$error = Registry::getRequest()->getRequestEscapedParameter('error'); $error = Registry::getRequest()->getRequestEscapedParameter('error');
if ( strlen((string) $error) ) { if (strlen((string) $error)) {
/** @var WebauthnCreateException $e */ /** @var WebauthnCreateException $e */
$e = oxNew(WebauthnCreateException::class, $error); $e = oxNew(WebauthnCreateException::class, $error);
throw $e; throw $e;
} }
$credential = Registry::getRequest()->getRequestEscapedParameter('credential'); $credential = Registry::getRequest()->getRequestEscapedParameter('credential');
if ( strlen((string) $credential) ) { if (strlen((string) $credential)) {
$webauthn = $this->d3GetMockableOxNewObject(Webauthn::class); $webauthn = $this->d3GetMockableOxNewObject(Webauthn::class);
$webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter( 'keyname' ) ); $webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter('keyname'));
} }
} catch (WebauthnException $e) { } catch (WebauthnException $e) {
$this->d3GetMockableLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $this->getEditObjectId()]); $this->d3GetMockableLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $this->getEditObjectId()]);
@ -175,4 +175,4 @@ class d3user_webauthn extends AdminDetailsController
$credential = $this->d3GetMockableOxNewObject(PublicKeyCredential::class); $credential = $this->d3GetMockableOxNewObject(PublicKeyCredential::class);
$credential->delete(Registry::getRequest()->getRequestEscapedParameter('deleteoxid')); $credential->delete(Registry::getRequest()->getRequestEscapedParameter('deleteoxid'));
} }
} }

View File

@ -118,7 +118,8 @@ class d3webauthnadminlogin extends AdminController
public function d3AssertAuthn(): ?string public function d3AssertAuthn(): ?string
{ {
try { try {
$login = $this->d3GetMockableOxNewObject(WebauthnLogin::class, $login = $this->d3GetMockableOxNewObject(
WebauthnLogin::class,
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'), $this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'),
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error') $this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error')
); );
@ -162,4 +163,4 @@ class d3webauthnadminlogin extends AdminController
{ {
return $this->previousClassIsOrderStep(); return $this->previousClassIsOrderStep();
} }
} }

View File

@ -27,4 +27,4 @@ trait accountTrait
parent::__construct(); parent::__construct();
} }
} }

View File

@ -54,4 +54,4 @@ trait checkoutGetUserTrait
return $user; return $user;
} }
} }

View File

@ -125,7 +125,7 @@ class d3_account_webauthn extends AccountController
$error = Registry::getRequest()->getRequestEscapedParameter('error'); $error = Registry::getRequest()->getRequestEscapedParameter('error');
if (strlen((string) $error)) { if (strlen((string) $error)) {
/** @var WebauthnCreateException $e */ /** @var WebauthnCreateException $e */
$e = oxNew( WebauthnCreateException::class, $error); $e = oxNew(WebauthnCreateException::class, $error);
throw $e; throw $e;
} }
@ -135,7 +135,7 @@ class d3_account_webauthn extends AccountController
$webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter('keyname')); $webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter('keyname'));
} }
} catch (WebauthnException $e) { } catch (WebauthnException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay( $e ); $this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e);
} }
} }
@ -180,4 +180,4 @@ class d3_account_webauthn extends AccountController
return $aPaths; return $aPaths;
} }
} }

View File

@ -156,4 +156,4 @@ class d3webauthnlogin extends FrontendController
return $aPaths; return $aPaths;
} }
} }

View File

@ -49,7 +49,7 @@ class PublicKeyCredential extends BaseModel
public function setName(string $name): void public function setName(string $name): void
{ {
$this->assign([ $this->assign([
'name' => $name 'name' => $name,
]); ]);
} }
@ -67,7 +67,7 @@ class PublicKeyCredential extends BaseModel
public function setCredentialId(string $credentialId): void public function setCredentialId(string $credentialId): void
{ {
$this->assign([ $this->assign([
'credentialid' => base64_encode($credentialId) 'credentialid' => base64_encode($credentialId),
]); ]);
} }
@ -85,7 +85,7 @@ class PublicKeyCredential extends BaseModel
public function setUserId(string $userId): void public function setUserId(string $userId): void
{ {
$this->assign([ $this->assign([
'oxuserid' => $userId 'oxuserid' => $userId,
]); ]);
} }
@ -103,7 +103,7 @@ class PublicKeyCredential extends BaseModel
public function setCredential(PublicKeyCredentialSource $credential): void public function setCredential(PublicKeyCredentialSource $credential): void
{ {
$this->assign([ $this->assign([
'credential' => base64_encode(serialize($credential)) 'credential' => base64_encode(serialize($credential)),
]); ]);
} }
@ -182,4 +182,4 @@ class PublicKeyCredential extends BaseModel
return strlen((string) $oxid) ? $oxid : null; return strlen((string) $oxid) ? $oxid : null;
} }
} }

View File

@ -162,4 +162,4 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
$base = $this->getBaseObject(); $base = $this->getBaseObject();
$base->saveCredentialSource($publicKeyCredentialSource); $base->saveCredentialSource($publicKeyCredentialSource);
} }
} }

View File

@ -23,4 +23,4 @@ class WebauthnCreateException extends WebauthnException
{ {
return WebauthnConf::TYPE_CREATE; return WebauthnConf::TYPE_CREATE;
} }
} }

View File

@ -26,19 +26,19 @@ class WebauthnException extends StandardException
public $detailedErrorMessage = null; public $detailedErrorMessage = null;
public function __construct( $sMessage = "not set", $iCode = 0, Exception $previous = null ) public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null)
{ {
$this->setDetailedErrorMessage($sMessage); $this->setDetailedErrorMessage($sMessage);
$this->d3CallMockableFunction( $this->d3CallMockableFunction(
[ [
StandardException::class, StandardException::class,
'__construct' '__construct',
], ],
[ [
$this->getErrorMessageTranslator()->translateError($sMessage, $this->getRequestType()), $this->getErrorMessageTranslator()->translateError($sMessage, $this->getRequestType()),
$iCode, $iCode,
$previous $previous,
] ]
); );
} }
@ -75,4 +75,4 @@ class WebauthnException extends StandardException
{ {
$this->detailedErrorMessage = 'Webauthn: '.$detailedErrorMessage; $this->detailedErrorMessage = 'Webauthn: '.$detailedErrorMessage;
} }
} }

View File

@ -23,4 +23,4 @@ class WebauthnGetException extends WebauthnException
{ {
return WebauthnConf::TYPE_GET; return WebauthnConf::TYPE_GET;
} }
} }

View File

@ -19,4 +19,4 @@ use OxidEsales\Eshop\Core\Exception\StandardException;
class WebauthnLoginErrorException extends StandardException class WebauthnLoginErrorException extends StandardException
{ {
} }

View File

@ -29,11 +29,11 @@ class RelyingPartyEntity extends PublicKeyCredentialRpEntity
$this->d3CallMockableFunction( $this->d3CallMockableFunction(
[ [
PublicKeyCredentialRpEntity::class, PublicKeyCredentialRpEntity::class,
'__construct' '__construct',
], ],
[ [
$this->getActiveShop()->getFieldData('oxname'), $this->getActiveShop()->getFieldData('oxname'),
$this->getRPShopUrl() $this->getRPShopUrl(),
] ]
); );
} }
@ -79,4 +79,4 @@ class RelyingPartyEntity extends PublicKeyCredentialRpEntity
{ {
return $this->d3GetMockableRegistryObject(Config::class)->getActiveShop(); return $this->d3GetMockableRegistryObject(Config::class)->getActiveShop();
} }
} }

View File

@ -39,13 +39,13 @@ class UserEntity extends PublicKeyCredentialUserEntity
$this->d3CallMockableFunction( $this->d3CallMockableFunction(
[ [
PublicKeyCredentialUserEntity::class, PublicKeyCredentialUserEntity::class,
'__construct' '__construct',
], ],
[ [
strtolower($user->getFieldData('oxusername')), strtolower($user->getFieldData('oxusername')),
$user->getId(), $user->getId(),
$user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname') $user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname'),
] ]
); );
} }
} }

View File

@ -56,7 +56,7 @@ class Webauthn
!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' || !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ||
!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on' ||
in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || // is localhost in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || // is localhost
(isset($_SERVER['REMOTE_ADDR']) && preg_match('/.*\.localhost$/mi', $_SERVER['REMOTE_ADDR']) ) // localhost is TLD (isset($_SERVER['REMOTE_ADDR']) && preg_match('/.*\.localhost$/mi', $_SERVER['REMOTE_ADDR'])) // localhost is TLD
) { ) {
return true; return true;
} }
@ -123,7 +123,7 @@ class Webauthn
*/ */
protected function jsonEncode($creationOptions) protected function jsonEncode($creationOptions)
{ {
return json_encode($creationOptions,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); return json_encode($creationOptions, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
} }
/** /**
@ -225,9 +225,9 @@ class Webauthn
try { try {
$this->getServer()->loadAndCheckAssertionResponse( $this->getServer()->loadAndCheckAssertionResponse(
html_entity_decode( $response ), html_entity_decode($response),
$this->d3GetMockableRegistryObject(Session::class) $this->d3GetMockableRegistryObject(Session::class)
->getVariable( self::SESSION_ASSERTION_OPTIONS ), ->getVariable(self::SESSION_ASSERTION_OPTIONS),
$userEntity, $userEntity,
$serverRequest $serverRequest
); );
@ -308,4 +308,4 @@ class Webauthn
return is_array($list) && count($list); return is_array($list) && count($list);
} }
} }

View File

@ -78,4 +78,4 @@ class WebauthnAfterLogin
$myUtilsServer->setOxCookie("oxidadminlanguage", $aLanguages[$iLang]->abbr, time() + 31536000); $myUtilsServer->setOxCookie("oxidadminlanguage", $aLanguages[$iLang]->abbr, time() + 31536000);
$language->setTplLanguage($iLang); $language->setTplLanguage($iLang);
} }
} }

View File

@ -41,4 +41,4 @@ class WebauthnConf
public const TYPE_CREATE = 'TYPECREATE'; public const TYPE_CREATE = 'TYPECREATE';
public const TYPE_GET = 'TYPEGET'; public const TYPE_GET = 'TYPEGET';
} }

View File

@ -59,7 +59,7 @@ class WebauthnErrors
} }
if (strtoupper($msg) === self::UNSECURECONNECTION) { if (strtoupper($msg) === self::UNSECURECONNECTION) {
return $lang->translateString($msg); return $lang->translateString($msg);
} }
return $lang->translateString('D3_WEBAUTHN_ERR_TECHNICALERROR', null, true); return $lang->translateString('D3_WEBAUTHN_ERR_TECHNICALERROR', null, true);
@ -72,9 +72,9 @@ class WebauthnErrors
public function getErrIdFromMessage(string $msg): string public function getErrIdFromMessage(string $msg): string
{ {
if (is_int(strpos($msg, ':'))) { if (is_int(strpos($msg, ':'))) {
return trim( strtolower( substr( $msg, 0, strpos( $msg, ':' ) ) ) ); return trim(strtolower(substr($msg, 0, strpos($msg, ':'))));
} }
return trim(strtolower($msg)); return trim(strtolower($msg));
} }
} }

View File

@ -360,4 +360,4 @@ class WebauthnLogin
$session->setVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH, $this->getCredential()); $session->setVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH, $this->getCredential());
$session->setVariable(WebauthnConf::OXID_FRONTEND_AUTH, $user->getId()); $session->setVariable(WebauthnConf::OXID_FRONTEND_AUTH, $user->getId());
} }
} }

View File

@ -16,7 +16,7 @@ $sLangName = 'Deutsch';
// ------------------------------- // -------------------------------
// RESOURCE IDENTIFIER = STRING // RESOURCE IDENTIFIER = STRING
// ------------------------------- // -------------------------------
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'PAGE_TITLE_D3WEBAUTHNLOGIN' => 'Passwortloses Anmelden', 'PAGE_TITLE_D3WEBAUTHNLOGIN' => 'Passwortloses Anmelden',
@ -25,7 +25,7 @@ $aLang = array(
'D3_WEBAUTHN_ACCOUNT_DESC' => 'Verwalten Sie hier Ihre Anmeldeschlüssel.', 'D3_WEBAUTHN_ACCOUNT_DESC' => 'Verwalten Sie hier Ihre Anmeldeschlüssel.',
'D3_WEBAUTHN_ACC_REGISTERNEW' => 'neue Registrierung erstellen', 'D3_WEBAUTHN_ACC_REGISTERNEW' => 'neue Registrierung erstellen',
'D3_WEBAUTHN_ACC_ADDKEY' => 'Sicherheitsschlüssel hinzufügen', 'D3_WEBAUTHN_ACC_ADDKEY' => 'Sicherheitsschlüssel hinzufügen',
'D3_WEBAUTHN_ACC_REGISTEREDKEYS' => 'registrierte Schlüssel', 'D3_WEBAUTHN_ACC_REGISTEREDKEYS' => 'registrierte Schlüssel',
'WEBAUTHN_INPUT_HELP' => 'Bitte mit Hardwareschlüssel authentisieren.', 'WEBAUTHN_INPUT_HELP' => 'Bitte mit Hardwareschlüssel authentisieren.',
@ -47,4 +47,4 @@ $aLang = array(
'D3_WEBAUTHN_ERR_UNSECURECONNECTION' => 'Die Verwendung von Sicherheitsschlüsseln ist nur bei lokalen oder gesicherten Verbindungen (https) möglich.', 'D3_WEBAUTHN_ERR_UNSECURECONNECTION' => 'Die Verwendung von Sicherheitsschlüsseln ist nur bei lokalen oder gesicherten Verbindungen (https) möglich.',
'D3_WEBAUTHN_ERR_LOGINPROHIBITED' => 'Die Anmeldung mit Sicherheitsschlüssel ist aus technischen Gründen derzeit leider nicht möglich. Bitte verwenden Sie statt dessen Ihr Passwort.', 'D3_WEBAUTHN_ERR_LOGINPROHIBITED' => 'Die Anmeldung mit Sicherheitsschlüssel ist aus technischen Gründen derzeit leider nicht möglich. Bitte verwenden Sie statt dessen Ihr Passwort.',
'D3_WEBAUTHN_ERR_NOTLOADEDUSER' => "Kann keine Anmeldedaten von nicht geladenem Kundenkonto beziehen.", 'D3_WEBAUTHN_ERR_NOTLOADEDUSER' => "Kann keine Anmeldedaten von nicht geladenem Kundenkonto beziehen.",
); ];

View File

@ -56,5 +56,5 @@ $aLang = [
'<p>Ist Ihr Shop unter verschiedenen Subdomains erreichbar, können Sie hier die Hauptdomain angeben, die zur Registrierung verwendet werden soll. Beachten Sie bitte, '. '<p>Ist Ihr Shop unter verschiedenen Subdomains erreichbar, können Sie hier die Hauptdomain angeben, die zur Registrierung verwendet werden soll. Beachten Sie bitte, '.
'dass die hier angegebene Adresse mit der des Shopaufrufs übereinstimmen muss. Shopfremde Adressen werden bei der Verwendung abgelehnt.</p>'. 'dass die hier angegebene Adresse mit der des Shopaufrufs übereinstimmen muss. Shopfremde Adressen werden bei der Verwendung abgelehnt.</p>'.
'<p>Bleibt das Feld leer, wird die Adresse des aktuellen Shopaufrufs verwendet. Bei Verwendung unterschiedlicher Adressen muss vom Nutzer für jede Adresse eine separate '. '<p>Bleibt das Feld leer, wird die Adresse des aktuellen Shopaufrufs verwendet. Bei Verwendung unterschiedlicher Adressen muss vom Nutzer für jede Adresse eine separate '.
'Schlüsselregistrierung durchgeführt werden.</p>' 'Schlüsselregistrierung durchgeführt werden.</p>',
]; ];

View File

@ -57,5 +57,5 @@ $aLang = [
'<p>If your shop can be reached under different subdomains, you can enter the main domain here that is to be used for registration. Please '. '<p>If your shop can be reached under different subdomains, you can enter the main domain here that is to be used for registration. Please '.
'note that the address given here must match the address of the shop call. Addresses that do not match the shop will be rejected.</p>'. 'note that the address given here must match the address of the shop call. Addresses that do not match the shop will be rejected.</p>'.
'<p>If the field remains empty, the address of the current shop call is used. If different addresses are used, a separate key registration '. '<p>If the field remains empty, the address of the current shop call is used. If different addresses are used, a separate key registration '.
'must be carried out by the user for each address.</p>' 'must be carried out by the user for each address.</p>',
]; ];

View File

@ -15,7 +15,9 @@ namespace D3\Webauthn\Modules\Application\Component
{ {
use OxidEsales\Eshop\Application\Component\UserComponent; use OxidEsales\Eshop\Application\Component\UserComponent;
class d3_webauthn_UserComponent_parent extends UserComponent {} class d3_webauthn_UserComponent_parent extends UserComponent
{
}
} }
namespace D3\Webauthn\Modules\Application\Controller namespace D3\Webauthn\Modules\Application\Controller
@ -35,44 +37,74 @@ namespace D3\Webauthn\Modules\Application\Controller
use OxidEsales\Eshop\Application\Controller\PaymentController; use OxidEsales\Eshop\Application\Controller\PaymentController;
use OxidEsales\Eshop\Application\Controller\UserController; use OxidEsales\Eshop\Application\Controller\UserController;
class d3_webauthn_UserController_parent extends UserController {} class d3_webauthn_UserController_parent extends UserController
{
}
class d3_webauthn_OrderController_parent extends OrderController {} class d3_webauthn_OrderController_parent extends OrderController
{
}
class d3_webauthn_PaymentController_parent extends PaymentController {} class d3_webauthn_PaymentController_parent extends PaymentController
{
}
/** workarounds for missing tpl blocks (https://github.com/OXID-eSales/wave-theme/pull/124) */ /** workarounds for missing tpl blocks (https://github.com/OXID-eSales/wave-theme/pull/124) */
class d3_AccountController_Webauthn_parent extends AccountController {} class d3_AccountController_Webauthn_parent extends AccountController
{
}
class d3_AccountDownloadsController_Webauthn_parent extends AccountDownloadsController {} class d3_AccountDownloadsController_Webauthn_parent extends AccountDownloadsController
{
}
class d3_AccountNoticeListController_Webauthn_parent extends AccountNoticeListController {} class d3_AccountNoticeListController_Webauthn_parent extends AccountNoticeListController
{
}
class d3_AccountWishlistController_Webauthn_parent extends AccountWishlistController {} class d3_AccountWishlistController_Webauthn_parent extends AccountWishlistController
{
}
class d3_AccountRecommlistController_Webauthn_parent extends AccountRecommlistController {} class d3_AccountRecommlistController_Webauthn_parent extends AccountRecommlistController
{
}
class d3_AccountPasswordController_Webauthn_parent extends AccountPasswordController {} class d3_AccountPasswordController_Webauthn_parent extends AccountPasswordController
{
}
class d3_AccountNewsletterController_Webauthn_parent extends AccountNewsletterController {} class d3_AccountNewsletterController_Webauthn_parent extends AccountNewsletterController
{
}
class d3_AccountUserController_Webauthn_parent extends AccountUserController {} class d3_AccountUserController_Webauthn_parent extends AccountUserController
{
}
class d3_AccountOrderController_Webauthn_parent extends AccountOrderController {} class d3_AccountOrderController_Webauthn_parent extends AccountOrderController
{
}
class d3_AccountReviewController_Webauthn_parent extends AccountReviewController {} class d3_AccountReviewController_Webauthn_parent extends AccountReviewController
{
}
} }
namespace D3\Webauthn\Modules\Application\Controller\Admin namespace D3\Webauthn\Modules\Application\Controller\Admin
{ {
use OxidEsales\Eshop\Application\Controller\Admin\LoginController; use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
class d3_LoginController_Webauthn_parent extends LoginController {} class d3_LoginController_Webauthn_parent extends LoginController
{
}
} }
namespace D3\Webauthn\Modules\Application\Model namespace D3\Webauthn\Modules\Application\Model
{ {
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;
class d3_User_Webauthn_parent extends User {} class d3_User_Webauthn_parent extends User
} {
}
}

View File

@ -58,12 +58,12 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
*/ */
public function d3WebauthnLogin(): void public function d3WebauthnLogin(): void
{ {
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'lgn_usr'); $lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('lgn_usr');
/** @var d3_User_Webauthn $user */ /** @var d3_User_Webauthn $user */
$user = $this->d3GetMockableOxNewObject(User::class); $user = $this->d3GetMockableOxNewObject(User::class);
$userId = $user->d3GetLoginUserId($lgn_user); $userId = $user->d3GetLoginUserId($lgn_user);
if ( $this->d3CanUseWebauthn( $lgn_user, $userId)) { if ($this->d3CanUseWebauthn($lgn_user, $userId)) {
if ($this->d3HasWebauthnButNotLoggedin($userId)) { if ($this->d3HasWebauthnButNotLoggedin($userId)) {
$session = $this->d3GetMockableRegistryObject(Session::class); $session = $this->d3GetMockableRegistryObject(Session::class);
$session->setVariable( $session->setVariable(
@ -95,15 +95,15 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
* *
* @return bool * @return bool
*/ */
protected function d3CanUseWebauthn( $lgn_user, ?string $userId): bool protected function d3CanUseWebauthn($lgn_user, ?string $userId): bool
{ {
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'lgn_pwd'); $password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('lgn_pwd');
return $lgn_user && return $lgn_user &&
$userId && $userId &&
false === $this->d3GetMockableRegistryObject(Session::class) false === $this->d3GetMockableRegistryObject(Session::class)
->hasVariable( WebauthnConf::WEBAUTHN_SESSION_AUTH ) && ->hasVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH) &&
( ! strlen( trim( (string) $password ) ) ); (! strlen(trim((string) $password)));
} }
/** /**
@ -147,7 +147,8 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
public function d3AssertAuthn(): void public function d3AssertAuthn(): void
{ {
try { try {
$login = $this->d3GetMockableOxNewObject(WebauthnLogin::class, $login = $this->d3GetMockableOxNewObject(
WebauthnLogin::class,
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'), $this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'),
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error') $this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error')
); );
@ -158,6 +159,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
$this->_afterLogin($this->getUser()); $this->_afterLogin($this->getUser());
} catch (WebauthnGetException $e) { } catch (WebauthnGetException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e); $this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e);
} catch (WebauthnLoginErrorException $e) {} } catch (WebauthnLoginErrorException $e) {
}
} }
} }

View File

@ -40,7 +40,7 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
*/ */
public function checklogin() public function checklogin()
{ {
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'user') ?: $lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('user') ?:
$this->d3GetMockableRegistryObject(Session::class) $this->d3GetMockableRegistryObject(Session::class)
->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_LOGINUSER); ->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_LOGINUSER);
@ -48,16 +48,16 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
$user = $this->d3GetMockableOxNewObject(User::class); $user = $this->d3GetMockableOxNewObject(User::class);
$userId = $user->d3GetLoginUserId($lgn_user, 'malladmin'); $userId = $user->d3GetLoginUserId($lgn_user, 'malladmin');
if ( $this->d3CanUseWebauthn( $lgn_user, $userId)) { if ($this->d3CanUseWebauthn($lgn_user, $userId)) {
$this->d3GetMockableRegistryObject(Session::class)->setVariable( $this->d3GetMockableRegistryObject(Session::class)->setVariable(
WebauthnConf::WEBAUTHN_ADMIN_PROFILE, WebauthnConf::WEBAUTHN_ADMIN_PROFILE,
$this->d3GetMockableRegistryObject(Request::class) $this->d3GetMockableRegistryObject(Request::class)
->getRequestEscapedParameter( 'profile') ->getRequestEscapedParameter('profile')
); );
$this->d3GetMockableRegistryObject(Session::class)->setVariable( $this->d3GetMockableRegistryObject(Session::class)->setVariable(
WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE, WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE,
$this->d3GetMockableRegistryObject(Request::class) $this->d3GetMockableRegistryObject(Request::class)
->getRequestEscapedParameter( 'chlanguage') ->getRequestEscapedParameter('chlanguage')
); );
if ($this->hasWebauthnButNotLoggedin($userId)) { if ($this->hasWebauthnButNotLoggedin($userId)) {
@ -96,15 +96,15 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
* *
* @return bool * @return bool
*/ */
protected function d3CanUseWebauthn( $lgn_user, ?string $userId): bool protected function d3CanUseWebauthn($lgn_user, ?string $userId): bool
{ {
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'pwd'); $password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('pwd');
return $lgn_user && return $lgn_user &&
$userId && $userId &&
false === $this->d3GetMockableRegistryObject(Session::class) false === $this->d3GetMockableRegistryObject(Session::class)
->hasVariable( WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH ) && ->hasVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH) &&
( ! strlen( trim( (string) $password ) ) ); (! strlen(trim((string) $password)));
} }
/** /**
@ -121,4 +121,4 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
&& !$this->d3GetMockableRegistryObject(Session::class) && !$this->d3GetMockableRegistryObject(Session::class)
->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH); ->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH);
} }
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountController_Webauthn extends d3_AccountController_Webauthn_parent class d3_AccountController_Webauthn extends d3_AccountController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountDownloadsController_Webauthn extends d3_AccountDownloadsController_Webauthn_parent class d3_AccountDownloadsController_Webauthn extends d3_AccountDownloadsController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountNewsletterController_Webauthn extends d3_AccountNewsletterController_Webauthn_parent class d3_AccountNewsletterController_Webauthn extends d3_AccountNewsletterController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountNoticeListController_Webauthn extends d3_AccountNoticeListController_Webauthn_parent class d3_AccountNoticeListController_Webauthn extends d3_AccountNoticeListController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountOrderController_Webauthn extends d3_AccountOrderController_Webauthn_parent class d3_AccountOrderController_Webauthn extends d3_AccountOrderController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountPasswordController_Webauthn extends d3_AccountPasswordController_Webauthn_parent class d3_AccountPasswordController_Webauthn extends d3_AccountPasswordController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountRecommlistController_Webauthn extends d3_AccountRecommlistController_Webauthn_parent class d3_AccountRecommlistController_Webauthn extends d3_AccountRecommlistController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountReviewController_Webauthn extends d3_AccountReviewController_Webauthn_parent class d3_AccountReviewController_Webauthn extends d3_AccountReviewController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountUserController_Webauthn extends d3_AccountUserController_Webauthn_parent class d3_AccountUserController_Webauthn extends d3_AccountUserController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -21,4 +21,4 @@ use D3\Webauthn\Application\Controller\Traits\accountTrait;
class d3_AccountWishlistController_Webauthn extends d3_AccountWishlistController_Webauthn_parent class d3_AccountWishlistController_Webauthn extends d3_AccountWishlistController_Webauthn_parent
{ {
use accountTrait; use accountTrait;
} }

View File

@ -22,4 +22,4 @@ class d3_webauthn_OrderController extends d3_webauthn_OrderController_parent
use checkoutGetUserTrait; use checkoutGetUserTrait;
private $parentClass = d3_webauthn_OrderController_parent::class; private $parentClass = d3_webauthn_OrderController_parent::class;
} }

View File

@ -22,4 +22,4 @@ class d3_webauthn_PaymentController extends d3_webauthn_PaymentController_parent
use checkoutGetUserTrait; use checkoutGetUserTrait;
private $parentClass = d3_webauthn_PaymentController_parent::class; private $parentClass = d3_webauthn_PaymentController_parent::class;
} }

View File

@ -22,4 +22,4 @@ class d3_webauthn_UserController extends d3_webauthn_UserController_parent
use checkoutGetUserTrait; use checkoutGetUserTrait;
private $parentClass = d3_webauthn_UserController_parent::class; private $parentClass = d3_webauthn_UserController_parent::class;
} }

View File

@ -99,7 +99,7 @@ class d3_User_Webauthn extends d3_User_Webauthn_parent
$this, $this,
[ [
$userName, $userName,
$shopId $shopId,
] ]
); );
} }
@ -145,4 +145,4 @@ class d3_User_Webauthn extends d3_User_Webauthn_parent
return $qb->execute()->fetchOne() ?: null; return $qb->execute()->fetchOne() ?: null;
} }
} }

View File

@ -139,8 +139,8 @@ class Actions
public function clearCache() public function clearCache()
{ {
try { try {
$oUtils = $this->d3GetMockableRegistryObject( Utils::class ); $oUtils = $this->d3GetMockableRegistryObject(Utils::class);
$oUtils->resetTemplateCache( $this->getModuleTemplates() ); $oUtils->resetTemplateCache($this->getModuleTemplates());
$oUtils->resetLanguageCache(); $oUtils->resetLanguageCache();
} catch (ContainerExceptionInterface|NotFoundExceptionInterface|ModuleConfigurationNotFoundException $e) { } catch (ContainerExceptionInterface|NotFoundExceptionInterface|ModuleConfigurationNotFoundException $e) {
$this->d3GetMockableLogger()->error($e->getMessage(), [$this]); $this->d3GetMockableLogger()->error($e->getMessage(), [$this]);
@ -175,7 +175,7 @@ class Actions
{ {
/** @var $template ModuleConfiguration\Template */ /** @var $template ModuleConfiguration\Template */
return array_map( return array_map(
function($template) { function ($template) {
return $template->getTemplateKey(); return $template->getTemplateKey();
}, },
$moduleConfiguration->getTemplates() $moduleConfiguration->getTemplates()
@ -191,7 +191,7 @@ class Actions
{ {
/** @var $templateBlock ModuleConfiguration\TemplateBlock */ /** @var $templateBlock ModuleConfiguration\TemplateBlock */
return array_map( return array_map(
function($templateBlock) { function ($templateBlock) {
return basename($templateBlock->getShopTemplatePath()); return basename($templateBlock->getShopTemplatePath());
}, },
$moduleConfiguration->getTemplateBlocks() $moduleConfiguration->getTemplateBlocks()
@ -261,4 +261,4 @@ class Actions
{ {
return ContainerFactory::getInstance()->getContainer(); return ContainerFactory::getInstance()->getContainer();
} }
} }

View File

@ -47,4 +47,4 @@ class Events
public static function onDeactivate(): void public static function onDeactivate(): void
{ {
} }
} }

View File

@ -61,7 +61,7 @@ $logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="he
/** /**
* Module information * Module information
*/ */
$aModule = array( $aModule = [
'id' => $sModuleId, 'id' => $sModuleId,
'title' => $logo.' Webauthn / FIDO2 Login', 'title' => $logo.' Webauthn / FIDO2 Login',
'description' => [ 'description' => [
@ -90,13 +90,13 @@ $aModule = array(
AccountNewsletterController::class => d3_AccountNewsletterController_Webauthn::class, AccountNewsletterController::class => d3_AccountNewsletterController_Webauthn::class,
AccountUserController::class => d3_AccountUserController_Webauthn::class, AccountUserController::class => d3_AccountUserController_Webauthn::class,
AccountOrderController::class => d3_AccountOrderController_Webauthn::class, AccountOrderController::class => d3_AccountOrderController_Webauthn::class,
AccountReviewController::class => d3_AccountReviewController_Webauthn::class AccountReviewController::class => d3_AccountReviewController_Webauthn::class,
], ],
'controllers' => [ 'controllers' => [
'd3user_webauthn' => d3user_webauthn::class, 'd3user_webauthn' => d3user_webauthn::class,
'd3webauthnlogin' => d3webauthnlogin::class, 'd3webauthnlogin' => d3webauthnlogin::class,
'd3webauthnadminlogin' => d3webauthnadminlogin::class, 'd3webauthnadminlogin' => d3webauthnadminlogin::class,
'd3_account_webauthn' => d3_account_webauthn::class 'd3_account_webauthn' => d3_account_webauthn::class,
], ],
'templates' => [ 'templates' => [
'd3user_webauthn.tpl' => 'd3/oxwebauthn/Application/views/admin/tpl/d3user_webauthn.tpl', 'd3user_webauthn.tpl' => 'd3/oxwebauthn/Application/views/admin/tpl/d3user_webauthn.tpl',
@ -139,14 +139,14 @@ $aModule = array(
'template' => 'page/checkout/inc/options.tpl', 'template' => 'page/checkout/inc/options.tpl',
'block' => 'checkout_options_login', 'block' => 'checkout_options_login',
'file' => 'Application/views/blocks/page/checkout/inc/checkout_options_login.tpl', 'file' => 'Application/views/blocks/page/checkout/inc/checkout_options_login.tpl',
] ],
], ],
'settings' => [ 'settings' => [
[ [
'group' => $sModuleId.'_general', 'group' => $sModuleId.'_general',
'name' => $sModuleId.'_diffshopurl', 'name' => $sModuleId.'_diffshopurl',
'type' => 'str', 'type' => 'str',
'value' => false 'value' => false,
], ],
] ],
); ];

View File

@ -41,7 +41,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'noadmin@user.localhost', 'oxusername' => 'noadmin@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456 'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
], ],
true true
); );
@ -54,7 +54,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'admin@user.localhost', 'oxusername' => 'admin@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456 'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
], ],
true true
); );
@ -67,7 +67,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 2, 'oxshopid' => 2,
'oxusername' => 'wrongshop@user.localhost', 'oxusername' => 'wrongshop@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456 'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
], ],
true true
); );
@ -80,7 +80,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'inactive@user.localhost', 'oxusername' => 'inactive@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456 'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
], ],
true true
); );
@ -126,4 +126,4 @@ class passwordAdminAuthTest extends integrationTestCase
'account ok' => ['admin@user.localhost', '123456', 'admin_start'], 'account ok' => ['admin@user.localhost', '123456', 'admin_start'],
]; ];
} }
} }

View File

@ -36,7 +36,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'noadmin@user.localhost', 'oxusername' => 'noadmin@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456 'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
] ]
); );
@ -48,7 +48,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 2, 'oxshopid' => 2,
'oxusername' => 'wrongshop_fe@user.localhost', 'oxusername' => 'wrongshop_fe@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456 'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
] ]
); );
@ -60,7 +60,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'inactive@user.localhost', 'oxusername' => 'inactive@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456 'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
] ]
); );
} }
@ -108,4 +108,4 @@ class passwordFrontendAuthTest extends integrationTestCase
'account ok' => ['noadmin@user.localhost', '123456', 'payment'], 'account ok' => ['noadmin@user.localhost', '123456', 'payment'],
]; ];
} }
} }

View File

@ -32,7 +32,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
2 => 'credId2', 2 => 'credId2',
3 => 'credId3', 3 => 'credId3',
4 => 'credId4', 4 => 'credId4',
5 => 'credId5' 5 => 'credId5',
]; ];
public function createTestData() public function createTestData()
@ -47,7 +47,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1, 'oxshopid' => 1,
'oxusername' => 'wawrongshopid@user.localhost', 'oxusername' => 'wawrongshopid@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456 'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__ 'oxstreet' => __CLASS__,
], ],
true true
); );
@ -60,7 +60,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1, 'oxshopid' => 1,
'name' => __CLASS__, 'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==', 'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgB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E6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
] ]
); );
@ -72,7 +72,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1, 'oxshopid' => 1,
'name' => __CLASS__, 'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==', 'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRobl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zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
] ]
); );
@ -84,7 +84,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1, 'oxshopid' => 1,
'name' => __CLASS__, 'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==', 'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV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6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
] ]
); );
@ -96,7 +96,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1, 'oxshopid' => 1,
'name' => __CLASS__, 'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==', 'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wM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hbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
] ]
); );
@ -108,7 +108,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 2, 'oxshopid' => 2,
'name' => __CLASS__, 'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==', 'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3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KgBvdGhlclVJIjtOO30=',
] ]
); );
} }
@ -142,4 +142,4 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'credpass. wrong shopid'=> ['wawrongshopid@user.localhost', '123456', 'admin_start'], 'credpass. wrong shopid'=> ['wawrongshopid@user.localhost', '123456', 'admin_start'],
]; ];
} }
} }

View File

@ -71,7 +71,7 @@ class d3user_webauthnTest extends TestCase
->onlyMethods([ ->onlyMethods([
'd3CallMockableFunction', 'd3CallMockableFunction',
'getEditObjectId', 'getEditObjectId',
'd3GetMockableOxNewObject' 'd3GetMockableOxNewObject',
]) ])
->getMock(); ->getMock();
$sutMock->method('d3CallMockableFunction')->willReturn(true); $sutMock->method('d3CallMockableFunction')->willReturn(true);
@ -145,7 +145,7 @@ class d3user_webauthnTest extends TestCase
'setPageType', 'setPageType',
'setAuthnRegister', 'setAuthnRegister',
'd3GetMockableLogger', 'd3GetMockableLogger',
'd3GetMockableRegistryObject' 'd3GetMockableRegistryObject',
]) ])
->getMock(); ->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType'); $sutMock->expects($this->atLeastOnce())->method('setPageType');
@ -194,7 +194,7 @@ class d3user_webauthnTest extends TestCase
'setPageType', 'setPageType',
'setAuthnRegister', 'setAuthnRegister',
'd3GetMockableLogger', 'd3GetMockableLogger',
'd3GetMockableRegistryObject' 'd3GetMockableRegistryObject',
]) ])
->getMock(); ->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType'); $sutMock->expects($this->atLeastOnce())->method('setPageType');
@ -566,7 +566,7 @@ class d3user_webauthnTest extends TestCase
public function canDeleteDataProvider(): array public function canDeleteDataProvider(): array
{ {
return [ return [
'has delete id' => ['deleteId', $this->once()] 'has delete id' => ['deleteId', $this->once()],
]; ];
} }
} }

View File

@ -61,7 +61,8 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
* @return void * @return void
*/ */
public function canGetNavigationParams() public function canGetNavigationParams()
{} {
}
/** /**
* @test * @test
@ -78,7 +79,7 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
->getMock(); ->getMock();
$sessionMock->method('hasVariable')->willReturnMap([ $sessionMock->method('hasVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH, $auth], [WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH, $auth],
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $userFromLogin] [WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $userFromLogin],
]); ]);
/** @var Utils|MockObject $utilsMock */ /** @var Utils|MockObject $utilsMock */
@ -97,7 +98,7 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
/** @var d3webauthnlogin|MockObject $sut */ /** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName) $sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction', 'd3GetMockableOxNewObject', ->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction', 'd3GetMockableOxNewObject',
'generateCredentialRequest', 'addTplParam']) 'generateCredentialRequest', 'addTplParam', ])
->getMock(); ->getMock();
$sut->method('d3GetMockableRegistryObject')->willReturnCallback( $sut->method('d3GetMockableRegistryObject')->willReturnCallback(
function () use ($utilsMock, $sessionMock) { function () use ($utilsMock, $sessionMock) {
@ -331,4 +332,4 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
'assertion succ shop1' => ['admin_start', false, 'cookie', 1], 'assertion succ shop1' => ['admin_start', false, 'cookie', 1],
]; ];
} }
} }

View File

@ -47,7 +47,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable']) ->onlyMethods(['getVariable'])
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturn([ $sessionMock->method('getVariable')->willReturn([
'key1' => 'variable1' 'key1' => 'variable1',
]); ]);
/** @var d3webauthnlogin|MockObject $sut */ /** @var d3webauthnlogin|MockObject $sut */
@ -71,7 +71,7 @@ class d3webauthnloginTest extends UnitTestCase
[ [
'defKey1' => 'devValues1', 'defKey1' => 'devValues1',
'key1' => 'variable1', 'key1' => 'variable1',
'cl' => NULL, 'cl' => null,
], ],
$this->callMethod( $this->callMethod(
$sut, $sut,
@ -99,7 +99,7 @@ class d3webauthnloginTest extends UnitTestCase
->getMock(); ->getMock();
$sessionMock->method('hasVariable')->willReturnMap([ $sessionMock->method('hasVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_SESSION_AUTH, $auth], [WebauthnConf::WEBAUTHN_SESSION_AUTH, $auth],
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $userFromLogin] [WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $userFromLogin],
]); ]);
/** @var Utils|MockObject $utilsMock */ /** @var Utils|MockObject $utilsMock */
@ -112,7 +112,7 @@ class d3webauthnloginTest extends UnitTestCase
/** @var d3webauthnlogin|MockObject $sut */ /** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName) $sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction', ->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction',
'generateCredentialRequest', 'addTplParam']) 'generateCredentialRequest', 'addTplParam', ])
->getMock(); ->getMock();
$sut->method('d3GetMockableRegistryObject')->willReturnCallback( $sut->method('d3GetMockableRegistryObject')->willReturnCallback(
function () use ($utilsMock, $sessionMock) { function () use ($utilsMock, $sessionMock) {
@ -174,7 +174,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable']) ->onlyMethods(['getVariable'])
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturnMap([ $sessionMock->method('getVariable')->willReturnMap([
[$userSessionVarName, $currUserFixture] [$userSessionVarName, $currUserFixture],
]); ]);
/** @var Webauthn|MockObject $webAuthnMock */ /** @var Webauthn|MockObject $webAuthnMock */
@ -240,7 +240,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable', 'setVariable']) ->onlyMethods(['getVariable', 'setVariable'])
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturnMap([ $sessionMock->method('getVariable')->willReturnMap([
[$userVarName, $currUserFixture] [$userVarName, $currUserFixture],
]); ]);
$sessionMock->expects($this->once())->method('setVariable')->with(WebauthnConf::GLOBAL_SWITCH) $sessionMock->expects($this->once())->method('setVariable')->with(WebauthnConf::GLOBAL_SWITCH)
->willReturn(true); ->willReturn(true);
@ -262,7 +262,7 @@ class d3webauthnloginTest extends UnitTestCase
/** @var d3webauthnlogin|MockObject $sut */ /** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName) $sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableOxNewObject', 'addTplParam', ->onlyMethods(['d3GetMockableOxNewObject', 'addTplParam',
'd3GetMockableLogger', 'd3GetMockableRegistryObject']) 'd3GetMockableLogger', 'd3GetMockableRegistryObject', ])
->getMock(); ->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback( $sut->method('d3GetMockableOxNewObject')->willReturnCallback(
function () use ($webAuthnMock) { function () use ($webAuthnMock) {
@ -313,7 +313,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable']) ->onlyMethods(['getVariable'])
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturnMap([ $sessionMock->method('getVariable')->willReturnMap([
[$sessionVarName, $currClassFixture] [$sessionVarName, $currClassFixture],
]); ]);
/** @var d3webauthnlogin|MockObject $sut */ /** @var d3webauthnlogin|MockObject $sut */
@ -410,7 +410,7 @@ class d3webauthnloginTest extends UnitTestCase
{ {
return [ return [
[true], [true],
[false] [false],
]; ];
} }
@ -431,4 +431,4 @@ class d3webauthnloginTest extends UnitTestCase
) )
); );
} }
} }

View File

@ -105,7 +105,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid); $pkc->setId($oxid);
$pkc->assign([ $pkc->assign([
'credentialid' => base64_encode('myCredentialId'), 'credentialid' => base64_encode('myCredentialId'),
'oxshopid' => 55 'oxshopid' => 55,
]); ]);
$pkc->setCredential($pkcsMock); $pkc->setCredential($pkcsMock);
$pkc->save(); $pkc->save();
@ -132,7 +132,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
{ {
return [ return [
'existing' => [true, 'pkcsource'], 'existing' => [true, 'pkcsource'],
'not existing' => [false, null] 'not existing' => [false, null],
]; ];
} }
@ -185,7 +185,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid); $pkc->setId($oxid);
$pkc->assign([ $pkc->assign([
'oxuserid' => 'userid', 'oxuserid' => 'userid',
'oxshopid' => 55 'oxshopid' => 55,
]); ]);
$pkc->setCredential($pkcsMock); $pkc->setCredential($pkcsMock);
$pkc->save(); $pkc->save();
@ -271,7 +271,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid); $pkc->setId($oxid);
$pkc->assign([ $pkc->assign([
'oxuserid' => 'userid', 'oxuserid' => 'userid',
'oxshopid' => 55 'oxshopid' => 55,
]); ]);
$pkc->setCredential($pkcsMock); $pkc->setCredential($pkcsMock);
$pkc->save(); $pkc->save();
@ -338,4 +338,4 @@ class PublicKeyCredentialListTest extends UnitTestCase
[$pkcsMock] [$pkcsMock]
); );
} }
} }

View File

@ -86,7 +86,7 @@ class PublicKeyCredentialTest extends UnitTestCase
/** @var PublicKeyCredential $sut */ /** @var PublicKeyCredential $sut */
$sut = oxNew(PublicKeyCredential::class); $sut = oxNew(PublicKeyCredential::class);
$sut->assign([ $sut->assign([
$fieldName => $setValue $fieldName => $setValue,
]); ]);
$this->assertEquals( $this->assertEquals(
@ -318,7 +318,7 @@ class PublicKeyCredentialTest extends UnitTestCase
$sut->setId($oxid); $sut->setId($oxid);
$sut->assign([ $sut->assign([
'credentialid' => base64_encode($pkcId), 'credentialid' => base64_encode($pkcId),
'oxshopid' => $shopId 'oxshopid' => $shopId,
]); ]);
$sut->save(); $sut->save();
} }
@ -344,7 +344,7 @@ class PublicKeyCredentialTest extends UnitTestCase
{ {
return [ return [
'item exists' => [true, 'idFixture'], 'item exists' => [true, 'idFixture'],
'item not exists' => [false, null] 'item not exists' => [false, null],
]; ];
} }
} }

View File

@ -46,4 +46,4 @@ class WebauthnCreateExceptionTest extends UnitTestCase
) )
); );
} }
} }

View File

@ -48,7 +48,7 @@ class WebauthnExceptionTest extends UnitTestCase
/** @var WebauthnException|MockObject $sut */ /** @var WebauthnException|MockObject $sut */
$sut = $this->getMockBuilder(WebauthnException::class) $sut = $this->getMockBuilder(WebauthnException::class)
->onlyMethods(['setDetailedErrorMessage', 'getErrorMessageTranslator', 'getRequestType', ->onlyMethods(['setDetailedErrorMessage', 'getErrorMessageTranslator', 'getRequestType',
'd3CallMockableFunction']) 'd3CallMockableFunction', ])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sut->expects($this->once())->method('setDetailedErrorMessage'); $sut->expects($this->once())->method('setDetailedErrorMessage');
@ -150,7 +150,7 @@ class WebauthnExceptionTest extends UnitTestCase
{ {
return [ return [
'message is string' => ['errorMessageFixture'], 'message is string' => ['errorMessageFixture'],
'message is null' => [null] 'message is null' => [null],
]; ];
} }
} }

View File

@ -46,4 +46,4 @@ class WebauthnGetExceptionTest extends UnitTestCase
) )
); );
} }
} }

View File

@ -96,7 +96,7 @@ class RelyingPartyEntityTest extends TestCase
'null' => [null, false], 'null' => [null, false],
'empty string' => ['', false], 'empty string' => ['', false],
'space string' => [' ', false], 'space string' => [' ', false],
'non empty string' => ['content', true] 'non empty string' => ['content', true],
]; ];
} }
@ -222,7 +222,7 @@ class RelyingPartyEntityTest extends TestCase
{ {
return [ return [
'configured' => [true, ' subd.mydomain.com', 'www.myhost.de', 'subd.mydomain.com'], 'configured' => [true, ' subd.mydomain.com', 'www.myhost.de', 'subd.mydomain.com'],
'not configured'=> [false, ' subd.mydomain.com', 'www.myhost.de', 'www.myhost.de'] 'not configured'=> [false, ' subd.mydomain.com', 'www.myhost.de', 'www.myhost.de'],
]; ];
} }
@ -249,4 +249,4 @@ class RelyingPartyEntityTest extends TestCase
) )
); );
} }
} }

View File

@ -59,7 +59,7 @@ class UserEntityTest extends UnitTestCase
$this->identicalTo([ $this->identicalTo([
'usernamefixture', 'usernamefixture',
'userId', 'userId',
'fNameFixture lNameFixture' 'fNameFixture lNameFixture',
]) ])
); );
@ -85,4 +85,4 @@ class UserEntityTest extends UnitTestCase
'user ok' => [true, 'userId', true], 'user ok' => [true, 'userId', true],
]; ];
} }
} }

View File

@ -66,7 +66,7 @@ class WebauthnAfterLoginTest extends UnitTestCase
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturnMap([ $sessionMock->method('getVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_ADMIN_PROFILE, $sessionProfile], [WebauthnConf::WEBAUTHN_ADMIN_PROFILE, $sessionProfile],
['aAdminProfiles', [['prof','No0'], ['prof', 'No1'], ['prof','No2']]] ['aAdminProfiles', [['prof','No0'], ['prof', 'No1'], ['prof','No2']]],
]); ]);
$sessionMock->expects($this->once())->method('deleteVariable'); $sessionMock->expects($this->once())->method('deleteVariable');
$sessionMock->expects($this->exactly((int) $setSessionVar))->method('setVariable'); $sessionMock->expects($this->exactly((int) $setSessionVar))->method('setVariable');
@ -210,7 +210,7 @@ class WebauthnAfterLoginTest extends UnitTestCase
$en_2->selected = 0; $en_2->selected = 0;
return [ return [
$de_1, $de_1,
$en_2 $en_2,
]; ];
} }
@ -227,4 +227,4 @@ class WebauthnAfterLoginTest extends UnitTestCase
'no selected language' => [null, null, 0, 'de'], 'no selected language' => [null, null, 0, 'de'],
]; ];
} }
} }

View File

@ -127,7 +127,7 @@ class WebauthnErrorsTest extends UnitTestCase
{ {
return [ return [
'with colon' => [' My Text With : Colon', 'my text with'], 'with colon' => [' My Text With : Colon', 'my text with'],
'without colon' => [' My Text With Colon', 'my text with colon'] 'without colon' => [' My Text With Colon', 'my text with colon'],
]; ];
} }
} }

View File

@ -216,7 +216,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class) $sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', ->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie', 'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie',
'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId']) 'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId', ])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sut->expects($this->exactly((int) $setCookie))->method('setSessionCookie'); $sut->expects($this->exactly((int) $setCookie))->method('setSessionCookie');
@ -281,7 +281,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class) $sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', 'd3GetMockableRegistryObject', ->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', 'd3GetMockableRegistryObject',
'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie', 'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie',
'd3GetMockableLogger', 'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId']) 'd3GetMockableLogger', 'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId', ])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass)); $sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass));
@ -350,7 +350,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class) $sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', ->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights',
'd3GetMockableOxNewObject']) 'd3GetMockableOxNewObject', ])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback( $sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -412,7 +412,7 @@ class WebauthnLoginTest extends UnitTestCase
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', ->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject', 'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject',
'd3GetMockableLogger']) 'd3GetMockableLogger', ])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass)); $sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass));
@ -675,7 +675,7 @@ class WebauthnLoginTest extends UnitTestCase
{ {
return [ return [
'set cookie' => [true], 'set cookie' => [true],
'dont set cookie' => [false] 'dont set cookie' => [false],
]; ];
} }
@ -1065,10 +1065,11 @@ class WebauthnLoginTest extends UnitTestCase
$sessionMock->method('getVariable')->willReturnCallback( $sessionMock->method('getVariable')->willReturnCallback(
function () { function () {
$args = func_get_args(); $args = func_get_args();
if ($args[0] === WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER) if ($args[0] === WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER) {
return 'adminUser'; return 'adminUser';
elseif ($args[0] === WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER) } elseif ($args[0] === WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER) {
return 'frontendUser'; return 'frontendUser';
}
return null; return null;
} }
); );
@ -1126,11 +1127,11 @@ class WebauthnLoginTest extends UnitTestCase
$sessionMock->expects($this->exactly(2))->method('setVariable')->withConsecutive( $sessionMock->expects($this->exactly(2))->method('setVariable')->withConsecutive(
[ [
$this->identicalTo(WebauthnConf::WEBAUTHN_SESSION_AUTH), $this->identicalTo(WebauthnConf::WEBAUTHN_SESSION_AUTH),
$this->identicalTo('credentialFixture') $this->identicalTo('credentialFixture'),
], ],
[ [
$this->identicalTo(WebauthnConf::OXID_FRONTEND_AUTH), $this->identicalTo(WebauthnConf::OXID_FRONTEND_AUTH),
$this->identicalTo('idFixture') $this->identicalTo('idFixture'),
] ]
); );
@ -1164,4 +1165,4 @@ class WebauthnLoginTest extends UnitTestCase
[$userMock] [$userMock]
); );
} }
} }

View File

@ -107,7 +107,7 @@ class WebauthnTest extends UnitTestCase
'REMOTE_ADDR v6' => [null, null, null, '::1', true], 'REMOTE_ADDR v6' => [null, null, null, '::1', true],
'REMOTE_ADDR localhost' => [null, null, null, 'some.localhost', true], 'REMOTE_ADDR localhost' => [null, null, null, 'some.localhost', true],
'unset' => [null, null, null, null, false], 'unset' => [null, null, null, null, false],
'not valid' => ['off', 'http', 'off', '160.158.23.7', false] 'not valid' => ['off', 'http', 'off', '160.158.23.7', false],
]; ];
} }
@ -164,7 +164,7 @@ class WebauthnTest extends UnitTestCase
/** @var Webauthn|MockObject $sut */ /** @var Webauthn|MockObject $sut */
$sut = $this->getMockBuilder(Webauthn::class) $sut = $this->getMockBuilder(Webauthn::class)
->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode', ->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode',
'getExistingCredentials' 'getExistingCredentials',
]) ])
->getMock(); ->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback( $sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -192,7 +192,7 @@ class WebauthnTest extends UnitTestCase
); );
$sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn); $sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn);
$sut->expects($this->once())->method('getExistingCredentials')->willReturn([ $sut->expects($this->once())->method('getExistingCredentials')->willReturn([
$pubKeyCredDescriptorMock $pubKeyCredDescriptorMock,
]); ]);
if (!$jsonReturn) { if (!$jsonReturn) {
@ -361,7 +361,7 @@ class WebauthnTest extends UnitTestCase
/** @var Webauthn|MockObject $sut */ /** @var Webauthn|MockObject $sut */
$sut = $this->getMockBuilder(Webauthn::class) $sut = $this->getMockBuilder(Webauthn::class)
->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode', ->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode',
'getExistingCredentials' 'getExistingCredentials',
]) ])
->getMock(); ->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback( $sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -391,7 +391,7 @@ class WebauthnTest extends UnitTestCase
); );
$sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn); $sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn);
$sut->expects($this->once())->method('getExistingCredentials')->willReturn([ $sut->expects($this->once())->method('getExistingCredentials')->willReturn([
$pubKeyCredDescriptorMock $pubKeyCredDescriptorMock,
]); ]);
if (!$jsonReturn) { if (!$jsonReturn) {
@ -695,7 +695,7 @@ class WebauthnTest extends UnitTestCase
$sessionMock->method('getVariable')->willReturnMap( $sessionMock->method('getVariable')->willReturnMap(
[ [
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $adminUser], [WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $adminUser],
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $frontendUser] [WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $frontendUser],
] ]
); );
@ -732,7 +732,7 @@ class WebauthnTest extends UnitTestCase
{ {
return [ return [
'admin' => [true, 'admUsr', 'frontendUsr', 'admUsr'], 'admin' => [true, 'admUsr', 'frontendUsr', 'admUsr'],
'frontend' => [false, 'admUsr', 'frontendUsr', 'frontendUsr'] 'frontend' => [false, 'admUsr', 'frontendUsr', 'frontendUsr'],
]; ];
} }
@ -819,7 +819,7 @@ class WebauthnTest extends UnitTestCase
'user use webauthn, config disabled' => [true, false, true, false], 'user use webauthn, config disabled' => [true, false, true, false],
'user use webauthn, session disabled' => [false, true, true, false], 'user use webauthn, session disabled' => [false, true, true, false],
'user use webauthn, both disabled' => [true, true, true, false], 'user use webauthn, both disabled' => [true, true, true, false],
'user dont use ' => [false, false, false, false] 'user dont use ' => [false, false, false, false],
]; ];
} }
@ -883,4 +883,4 @@ class WebauthnTest extends UnitTestCase
'filled array' => [['abc'], true], 'filled array' => [['abc'], true],
]; ];
} }
} }

View File

@ -92,7 +92,7 @@ class UserComponentWebauthnTest extends UnitTestCase
->onlyMethods(['getRequestParameter']) ->onlyMethods(['getRequestParameter'])
->getMock(); ->getMock();
$requestMock->method('getRequestParameter')->willReturnMap([ $requestMock->method('getRequestParameter')->willReturnMap([
['lgn_usr', 'myUserName'] ['lgn_usr', 'myUserName'],
]); ]);
/** @var User|MockObject $userMock */ /** @var User|MockObject $userMock */
@ -112,7 +112,7 @@ class UserComponentWebauthnTest extends UnitTestCase
/** @var d3_webauthn_UserComponent|MockObject $sut */ /** @var d3_webauthn_UserComponent|MockObject $sut */
$sut = $this->getMockBuilder(UserComponent::class) $sut = $this->getMockBuilder(UserComponent::class)
->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'd3HasWebauthnButNotLoggedin', ->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'd3HasWebauthnButNotLoggedin',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject', 'getParent' 'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject', 'getParent',
]) ])
->getMock(); ->getMock();
$sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn); $sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn);
@ -433,7 +433,7 @@ class UserComponentWebauthnTest extends UnitTestCase
return [ return [
'passed' => [null, $this->once(), $this->never()], 'passed' => [null, $this->once(), $this->never()],
'webauthnException' => [WebauthnGetException::class, $this->never(), $this->once()], 'webauthnException' => [WebauthnGetException::class, $this->never(), $this->once()],
'webauthnLoginError' => [WebauthnLoginErrorException::class, $this->never(), $this->never()] 'webauthnLoginError' => [WebauthnLoginErrorException::class, $this->never(), $this->never()],
]; ];
} }
} }

View File

@ -23,4 +23,4 @@ class AccountControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountController::class; protected $sutClass = AccountController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountDownloadsControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountDownloadsController::class; protected $sutClass = AccountDownloadsController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountNewsletterControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountNewsletterController::class; protected $sutClass = AccountNewsletterController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountNoticeListControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountNoticeListController::class; protected $sutClass = AccountNoticeListController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountOrderControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountOrderController::class; protected $sutClass = AccountOrderController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountPasswordControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountPasswordController::class; protected $sutClass = AccountPasswordController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountRecommlistControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountRecommlistController::class; protected $sutClass = AccountRecommlistController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountReviewControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountReviewController::class; protected $sutClass = AccountReviewController::class;
} }

View File

@ -70,4 +70,4 @@ trait AccountTestTrait
) )
); );
} }
} }

View File

@ -23,4 +23,4 @@ class AccountUserControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountUserController::class; protected $sutClass = AccountUserController::class;
} }

View File

@ -23,4 +23,4 @@ class AccountWishlistControllerTest extends UnitTestCase
use AccountTestTrait; use AccountTestTrait;
protected $sutClass = AccountWishlistController::class; protected $sutClass = AccountWishlistController::class;
} }

View File

@ -228,7 +228,7 @@ class LoginControllerWebauthnTest extends UnitTestCase
->getMock(); ->getMock();
$requestMock->method('getRequestParameter')->willReturnMap([ $requestMock->method('getRequestParameter')->willReturnMap([
['user', 'myUserName'], ['user', 'myUserName'],
['profile', 'myProfile'] ['profile', 'myProfile'],
]); ]);
/** @var User|MockObject $userMock */ /** @var User|MockObject $userMock */
@ -248,7 +248,7 @@ class LoginControllerWebauthnTest extends UnitTestCase
/** @var LoginController|MockObject $sut */ /** @var LoginController|MockObject $sut */
$sut = $this->getMockBuilder(LoginController::class) $sut = $this->getMockBuilder(LoginController::class)
->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'hasWebauthnButNotLoggedin', ->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'hasWebauthnButNotLoggedin',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject' 'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject',
]) ])
->getMock(); ->getMock();
$sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn); $sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn);
@ -299,4 +299,4 @@ class LoginControllerWebauthnTest extends UnitTestCase
'passed' => [true, true, 5, 'd3webauthnadminlogin'], 'passed' => [true, true, 5, 'd3webauthnadminlogin'],
]; ];
} }
} }

View File

@ -117,7 +117,7 @@ trait CheckoutTestTrait
$sut->setUser(oxNew(User::class)); $sut->setUser(oxNew(User::class));
if ($expected === 'parent') { if ($expected === 'parent') {
$this->assertSame( $return, $hasUser ? $this->userFixture : false); $this->assertSame($return, $hasUser ? $this->userFixture : false);
} else { } else {
$this->assertSame($return, $expected); $this->assertSame($return, $expected);
} }
@ -142,4 +142,4 @@ trait CheckoutTestTrait
'no webauthn auth' => [true, true, null, false], 'no webauthn auth' => [true, true, null, false],
]; ];
} }
} }

View File

@ -23,4 +23,4 @@ class OrderControllerTest extends UnitTestCase
use CheckoutTestTrait; use CheckoutTestTrait;
protected $sutClass = OrderController::class; protected $sutClass = OrderController::class;
} }

View File

@ -23,4 +23,4 @@ class PaymentControllerTest extends UnitTestCase
use CheckoutTestTrait; use CheckoutTestTrait;
protected $sutClass = PaymentController::class; protected $sutClass = PaymentController::class;
} }

View File

@ -23,4 +23,4 @@ class UserControllerTest extends UnitTestCase
use CheckoutTestTrait; use CheckoutTestTrait;
protected $sutClass = UserController::class; protected $sutClass = UserController::class;
} }

View File

@ -58,7 +58,8 @@ class UserWebauthnTest extends UnitTestCase
/** @var d3_User_Webauthn $user */ /** @var d3_User_Webauthn $user */
$user = oxNew(User::class); $user = oxNew(User::class);
$user->delete($this->userId); $user->delete($this->userId);
} catch (Exception $e) {} } catch (Exception $e) {
}
} }
/** /**
@ -163,7 +164,7 @@ class UserWebauthnTest extends UnitTestCase
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturnMap([ $sessionMock->method('getVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_SESSION_AUTH, $authInSession], [WebauthnConf::WEBAUTHN_SESSION_AUTH, $authInSession],
[WebauthnConf::WEBAUTHN_SESSION_LOGINUSER, $userNameInSession] [WebauthnConf::WEBAUTHN_SESSION_LOGINUSER, $userNameInSession],
]); ]);
/** @var User|MockObject $sut */ /** @var User|MockObject $sut */
@ -275,4 +276,4 @@ class UserWebauthnTest extends UnitTestCase
'user not loadable' => ['unknown', '15', '20', null], 'user not loadable' => ['unknown', '15', '20', null],
]; ];
} }
} }

View File

@ -569,7 +569,7 @@ class ActionsTest extends UnitTestCase
{ {
return [ return [
'has SEO url' => ['https://testshop.dev/securitykeys', true], 'has SEO url' => ['https://testshop.dev/securitykeys', true],
'has no SEO url'=> ['', false] 'has no SEO url'=> ['', false],
]; ];
} }
@ -625,4 +625,4 @@ class ActionsTest extends UnitTestCase
) )
); );
} }
} }