n92
n92

Reputation: 7592

Authorization and Authentication mechanism in CakePHP

I have been using GRAILS since a year, It found very easy to implement security services as it provides spring source security plugin AND acegi.

The features of that plugin are

1) Create as many roles 2) Create users and assign them roles 3) Login and Logout

So, I have not found any such thing in cakephp, Is there any plugin, which provides Authentication and Authorization features as listed above,

Upvotes: 0

Views: 291

Answers (1)

deceze
deceze

Reputation: 521995

Authentication is handled using the built-in Cake AuthComponent. It takes care of logging users in and out.

Authorization can be implemented in several different ways. For example, to authorize an entire controller to certain users, use the 'Controller' authorization method and create a method in your controller like:

public function isAuthorized($user = null) {
    return $user['role'] == 'admin';
}

You can also do this in individual actions, or use a complete ACL setup.

Either way, read the manual: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html

Upvotes: 1

Related Questions