I'm working on a CakePHP project and am currently building the user authentication part of it. The problem is that my authentication information (ie: the passwords) are not stored in my database -- the authentication source is LDAP but my question applies equally to any non-database source.
It appears as though Cake only handles passwords when they exist in the local database. The Cake Cookbook suggests that you can tell it a different controller/model/object to provide an authorization procedure by using the $this->Auth->authorize
variable, however looking at the code (specifically the Auth::startup()
function) it looks like Cake will always try to query the database first, checking for a matching username/password, before then looking at the alternative object you specified with Auth->authorize
. That is, changing authorize
only adds a second-level filter, it doesn't replace the database lookup.
// The process
1. User provides details
2. Cake checks the database
3. If OK, then check the custom object method
4. If OK, return true
// What I'd like:
1. User provides details.
2. Check the custom object method
3. If OK, return true
4. Profit.
Any ideas on how to do this, hopefully without hacking the core files?