Skip to content

Commit

Permalink
Merge pull request #1059 from BearGroup/integration
Browse files Browse the repository at this point in the history
Remove dependency on laminas module due to incompatibility with older…
  • Loading branch information
Christian Zichichi authored Jun 15, 2021
2 parents 209f3bc + d2746c4 commit af61f53
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Controller/AutoKeyExchange/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ class Listener extends \Magento\Framework\App\Action\Action implements CsrfAware
*/
private $exceptionLogger;

/**
* @var \Laminas\Uri\Http
*/
private $uri;

/**
* Listener constructor.
* @param \Magento\Framework\App\Action\Context $context
Expand All @@ -57,12 +52,10 @@ public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Controller\Result\JsonFactory $jsonResultFactory,
\Amazon\Pay\Model\Config\AutoKeyExchange $autokeyexchange,
\Laminas\Uri\Http $uri,
ExceptionLogger $exceptionLogger = null
) {
$this->autokeyexchange = $autokeyexchange;
$this->jsonResultFactory = $jsonResultFactory;
$this->uri = $uri;
$this->exceptionLogger = $exceptionLogger ?: ObjectManager::getInstance()->get(ExceptionLogger::class);
parent::__construct($context);
}
Expand All @@ -74,7 +67,7 @@ public function execute()
{
try {
$originHeader = $this->getRequest()->getHeader('Origin');
if (!empty($originHeader) && $host = $this->uri->parse($originHeader)->getHost()) {
if (!empty($originHeader) && $host = parse_url($originHeader, PHP_URL_HOST)) {
if (in_array($host, $this->autokeyexchange->getListenerOrigins())) {
$this->getResponse()->setHeader('Access-Control-Allow-Origin', 'https://' . $host);
}
Expand Down

0 comments on commit af61f53

Please sign in to comment.