cakephp: Custom Authentication Object authenticate not called

Posted by Kristoffer Darj on Stack Overflow See other posts from Stack Overflow or by Kristoffer Darj
Published on 2013-11-07T15:51:51Z Indexed on 2013/11/07 15:53 UTC
Read the original article Hit count: 446

The method authenticate in a Custom Authentication Object is never called. Is this a glicth or am I missing something?

I don't get anything in the log, I'm just redirected to users/login (or the one I specified)

CakeVersion: 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');
    }
}

If I add the method getUser() (or unauthenticated() ), those gets called however so at least I know that cake finds the class and so on. It just skips the authenticate-method.

The AppController looks like this

class AppController extends Controller {

    public $helpers = array('Html', 'Form', 'Session');
    public $components =    array('Auth' => array(
        'authenticate' => array('Hash'),
        'authorize'      => array('Controller'),
        )
    );
}

I found a similar question here: CakePHP 2.x custom "Authentication adapter &quot;LdapAuthorize&quot; was not found but there the issue was typos.

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about authentication