CakePHP Bypass Auth component
Is it possible to bypass the Auth component and be logged in as an administrator? I want to test a plugin I downloaded and it requires you to be logged in using the Auth component as admin but I don't开发者_如何转开发 want to setup a users table etc.
You can bypass authentication by using the following code in your beforeFilter() of your controller:
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('*');
}
If you want to toggle only specific actions:
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('admin_index', 'admin_view');
}
Now, you won't have to log in to access these pages. :)
精彩评论