本文整理汇总了PHP中Magento\Backend\Model\UrlInterface::getSecretKey方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlInterface::getSecretKey方法的具体用法?PHP UrlInterface::getSecretKey怎么用?PHP UrlInterface::getSecretKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\UrlInterface
的用法示例。
在下文中一共展示了UrlInterface::getSecretKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetSecretKeyForwarded
/**
* @magentoAppIsolation enabled
*/
public function testGetSecretKeyForwarded()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $encryptor \Magento\Framework\Encryption\EncryptorInterface */
$encryptor = $objectManager->get('Magento\\Framework\\Encryption\\EncryptorInterface');
/** @var $request \Magento\Framework\App\Request\Http */
$request = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\App\\RequestInterface');
$request->setControllerName('controller')->setActionName('action');
$request->initForward()->setControllerName(uniqid())->setActionName(uniqid());
$this->_model->setRequest($request);
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\Session\\SessionManagerInterface')->setData('_form_key', 'salt');
$this->assertEquals($encryptor->getHash('controller' . 'action' . 'salt'), $this->_model->getSecretKey());
}
示例2: _validateSecretKey
/**
* Validate Secret Key
*
* @return bool
*/
protected function _validateSecretKey()
{
if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
return true;
}
$secretKey = $this->getRequest()->getParam(\Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME, null);
if (!$secretKey || $secretKey != $this->_backendUrl->getSecretKey()) {
return false;
}
return true;
}
示例3: _callbackSecretKey
/**
* Replace Callback Secret Key
*
* @param string[] $match
* @return string
*/
protected function _callbackSecretKey($match)
{
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey($match[1], $match[2], $match[3]);
}