2022-10-24 22:24:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2022-11-04 22:45:47 +01:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2022-10-24 22:24:40 +02:00
|
|
|
*
|
2022-11-04 22:45:47 +01:00
|
|
|
* https://www.d3data.de
|
2022-10-24 22:24:40 +02:00
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2022-11-04 22:45:47 +01:00
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
2022-10-24 22:24:40 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-10-31 00:11:06 +01:00
|
|
|
namespace D3\Webauthn\Application\Model;
|
2022-10-24 22:24:40 +02:00
|
|
|
|
2022-12-01 00:45:39 +01:00
|
|
|
use D3\TestingTools\Production\IsMockable;
|
|
|
|
use OxidEsales\Eshop\Application\Model\Shop;
|
|
|
|
use OxidEsales\Eshop\Core\Config;
|
2022-10-24 22:24:40 +02:00
|
|
|
use Webauthn\PublicKeyCredentialRpEntity;
|
|
|
|
|
2022-10-31 00:11:06 +01:00
|
|
|
class RelyingPartyEntity extends PublicKeyCredentialRpEntity
|
2022-10-24 22:24:40 +02:00
|
|
|
{
|
2022-12-01 00:45:39 +01:00
|
|
|
use IsMockable;
|
|
|
|
|
2022-10-31 00:11:06 +01:00
|
|
|
public function __construct()
|
2022-10-24 22:24:40 +02:00
|
|
|
{
|
2022-12-07 12:03:24 +01:00
|
|
|
$this->d3CallMockableFunction(
|
|
|
|
[
|
|
|
|
PublicKeyCredentialRpEntity::class,
|
2022-12-13 22:24:33 +01:00
|
|
|
'__construct',
|
2022-12-07 12:03:24 +01:00
|
|
|
],
|
2022-12-01 00:45:39 +01:00
|
|
|
[
|
|
|
|
$this->getActiveShop()->getFieldData('oxname'),
|
2022-12-13 22:24:33 +01:00
|
|
|
$this->getRPShopUrl(),
|
2022-12-01 00:45:39 +01:00
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getShopUrlByHost(): string
|
|
|
|
{
|
|
|
|
return preg_replace('/(^www\.)(.*)/mi', '$2', $_SERVER['HTTP_HOST']);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getRPShopUrl(): ?string
|
|
|
|
{
|
2022-12-15 23:08:23 +01:00
|
|
|
return $this->getShopUrlByHost();
|
2022-12-01 00:45:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Shop
|
|
|
|
*/
|
|
|
|
public function getActiveShop(): Shop
|
|
|
|
{
|
2023-01-21 13:50:18 +01:00
|
|
|
return d3GetOxidDIC()->get('d3ox.webauthn.'.Config::class)->getActiveShop();
|
2022-10-24 22:24:40 +02:00
|
|
|
}
|
2022-12-13 22:24:33 +01:00
|
|
|
}
|