-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from magento-sparta/MDVA-57_SECURITY_BUNDLE
[SUPPORT] Merchant Beta Security Bundle (MDVA-57)
- Loading branch information
Showing
85 changed files
with
1,906 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Model; | ||
|
||
use Magento\Framework\App\Router\PathConfigInterface; | ||
use Magento\Store\Model\Store; | ||
|
||
/** | ||
* Path config to be used in adminhtml area | ||
*/ | ||
class AdminPathConfig implements PathConfigInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\App\Config\ScopeConfigInterface | ||
*/ | ||
protected $coreConfig; | ||
|
||
/** | ||
* @var \Magento\Backend\App\ConfigInterface | ||
*/ | ||
protected $backendConfig; | ||
|
||
/** | ||
* @var \Magento\Framework\UrlInterface | ||
*/ | ||
protected $url; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig | ||
* @param \Magento\Backend\App\ConfigInterface $backendConfig | ||
* @param \Magento\Framework\UrlInterface $url | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, | ||
\Magento\Backend\App\ConfigInterface $backendConfig, | ||
\Magento\Framework\UrlInterface $url | ||
) { | ||
$this->coreConfig = $coreConfig; | ||
$this->backendConfig = $backendConfig; | ||
$this->url = $url; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param \Magento\Framework\App\RequestInterface $request | ||
* @return string | ||
*/ | ||
public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request) | ||
{ | ||
return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function shouldBeSecure($path) | ||
{ | ||
return substr( | ||
(string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'), | ||
0, | ||
5 | ||
) === 'https' | ||
|| $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML) | ||
&& substr( | ||
(string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'), | ||
0, | ||
5 | ||
) === 'https'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @return string | ||
*/ | ||
public function getDefaultPath() | ||
{ | ||
return $this->backendConfig->getValue('web/default/admin'); | ||
} | ||
} |
Oops, something went wrong.