Exemplo n.º 1
0
    /**
     * Retrieve is secure mode URL
     *
     * @return bool
     */
    protected function _isSecure()
    {
        if ($this->_request->isSecure()) {
            return true;
        }

        if ($this->getRouteParamsResolver()->hasData('secure_is_forced')) {
            return (bool) $this->getRouteParamsResolver()->getData('secure');
        }

        if (!$this->_getScope()->isUrlSecure()) {
            return false;
        }

        if (!$this->getRouteParamsResolver()->hasData('secure')) {
            if ($this->_getType() == UrlInterface::URL_TYPE_LINK) {
                $pathSecure = $this->_urlSecurityInfo->isSecure('/' . $this->_getActionPath());
                $this->getRouteParamsResolver()->setData('secure', $pathSecure);
            } elseif ($this->_getType() == UrlInterface::URL_TYPE_STATIC) {
                $isRequestSecure = $this->_getRequest()->isSecure();
                $this->getRouteParamsResolver()->setData('secure', $isRequestSecure);
            } else {
                $this->getRouteParamsResolver()->setData('secure', true);
            }
        }

        return $this->getRouteParamsResolver()->getData('secure');
    }
Exemplo n.º 2
0
 /**
  * Check whether given path should be secure according to configuration security requirements for URL
  * "Secure" should not be confused with https protocol, it is about web/secure/*_url settings usage only
  *
  * @param string $path
  * @return bool
  */
 protected function _shouldBeSecure($path)
 {
     return parse_url($this->_scopeConfig->getValue('web/unsecure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME) === 'https' || $this->_scopeConfig->isSetFlag(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && parse_url($this->_scopeConfig->getValue('web/secure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME) == 'https' && $this->_urlSecurityInfo->isSecure($path);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  *
  * @param string $path
  * @return bool
  */
 public function shouldBeSecure($path)
 {
     return parse_url($this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME) === 'https' || $this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_FRONTEND, ScopeInterface::SCOPE_STORE) && parse_url($this->scopeConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME) == 'https' && $this->urlSecurityInfo->isSecure($path);
 }