How to use AuthComponent in Cakephp 1.2
How do you use AuthComponent and AclComponent to authenticate users? On app_controller.php,
put this code:
class AppController extends Controller {
var $components = array(’Acl’,'Auth’,'Cookie’,'Session’);
function beforeFilter() {
$this->Auth->loginAction = ‘/users/login’;
$this->Auth->loginRedirect = ‘/questions/Various-Topics’;
$this->Auth->authorize = ‘actions’;
}
?>
and, on every controller, create a beforeFilter function and put this :
//var_dump($this->params);
this->Auth->allow(’action1′,’action2′);
parent::beforeFilter();
}
Note, however , since AuthComponent is authenticating users based on controller actions with Acl, you will have to build your own cake acl too.
PS. Thanks to ditchx and primerg for the help!
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.

No comments yet.
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>