自定义身份验证对象中的身份验证方法永远不会被调用。这是一个错误还是我错过了什么?
我没有在日志中得到任何东西,我只是被重定向到用户/登录名(或我指定的那个)
蛋糕版本:2.4.1
<?php
//My custom Auth Class
//Path: app/Controller/Component/Auth/HashAuthenticate.php
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
class HashAuthenticate extends BaseAuthenticate
{
public function authenticate(CakeRequest $request, CakeResponse $response)
{
//Seems to not be called
CakeLog::write('authenticate');
debug($this);
die('gaah');
}
}
如果我添加方法 getUser() (或 unauthenticated() ),那些会被调用,所以至少我知道 cake 找到了类等等。它只是跳过验证方法。
AppController 看起来像这样
<?php
// AppController
App::uses('Controller', 'Controller');
App::uses('HashAuthenticate', 'Controller/Component/Auth');
class AppController extends Controller {
public $helpers = array('Html', 'Form', 'Session');
public $components = array('Auth' => array(
'authenticate' => array('Hash'),
'authorize' => array('Controller'),
)
);
}
我在这里发现了一个类似的问题:CakePHP 2.x custom "Authentication adapter "LdapAuthorize" is not found but there's the issue is typos.