如何禁用cakephp安全性?

时间:2013-05-21 17:31:26

标签: security cakephp

我用过

public function beforeFilter() {
    parent::beforeFilter();
    $this->Security->validatePost = false;
    $this->Security->csrfCheck = false;
    $this->Security->unlockedActions = array('my_action');
}

但它不起作用,仍然报告

Security Error
The requested address was not found on this server.

Request blackholed due to "auth" violation.

我记得它工作正常,我可以发布我的数据,但它突然停止了。我不确定会发生什么,并尝试我所有的搜索结果,但它不起作用。如何在CakePHP中停止安全组件?

我甚至使用

public function beforeFilter() {
    parent::beforeFilter();
    $this->Components->disable('Security');
}

1 个答案:

答案 0 :(得分:0)

您可以尝试SecurityComponent::validatePost使用configuration option用于:

这里是我刚刚根据您的需要为特定行动定义的。

if(in_array($this->action,array(“some_action”))){
$this->Security->validatePost = false;

}
相关问题