Hi all,
I am currently developing in Cake 1.3 and I've been attempting to
override the AuthComponent as described in:

http://www.milestree.com/php/custom-login-function-with-cakephp
http://cakebaker.42dh.com/2009/09/08/extending-cakephps-core-components/

I started out with a working implementation of Auth + Acl and now I
need to add a third criteria to the our login/security model.

My code snippets look as such:

/** app_controller.php **/
class AppController extends Controller {

    public $components = array(
        'Acl',
//        'Auth',
        'CoreAuth',
        'Session',
        'Cookie',);

 public function beforeFilter() {
        parent::beforeFilter();

        $this->_setupAuthComponent();

       // do some more pre-Auth stuff here

        if(!$this->CoreAuth->user()) {
            //do NOT Authed stuff here
        } else {
           // do Authed stuff here
        }
    }

   private function _setupAuthComponent() {
       // do all my Auth variable initialization here...replace $this-
>Auth with $this->CoreAuth
   }
}

/** users_controller.php **/
class UsersController extends AppController {
    public $name = 'Users';
    public $components = array('Password', 'Email');

    public login(){
    // do post Auth stuff here
    }

    public logout() {
        // do logout stuff here
    }
}

/** core_auth.php **/
App::import('Component', 'Auth');

class CoreAuthComponent extends AuthComponent {
    public $name = 'CoreAuth';

   /**
     * Custom user identification
     */
    public function identify($user=null, $conditions=null) {
       // do my custom login / authentication stuff

       // send the user to Auth now
       parent::indentify($user, false);
    }
}

I have gone through my scripts and replaced "$this->Auth" with "$this-
>CoreAuth" .... I'm not getting through a login now... if i try to
debug $this->CoreAuth at any point during the login process, "Auth"
doesnt appear to be instantiated at all... inheritance hasn't occurred
after extending it in CoreAuthComponent.....

Some guidance would be appreciated.

Max

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to