カスタム認証オブジェクトのメソッド authenticate は呼び出されません。これはグリッチですか、それとも何か不足していますか?
ログに何も記録されません。ユーザー/ログイン (または指定したもの) にリダイレクトされるだけです。
Cakeバージョン: 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" was not found but there the issue was typos.