Note that there are some explanatory texts on larger screens.

plurals
  1. POAlternative authentication sources in CakePHP (LDAP)
    text
    copied!<p>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.</p> <p>It appears as though Cake only handles passwords when they exist in the local database. <a href="http://book.cakephp.org/view/248/AuthComponent-Variables" rel="nofollow noreferrer">The Cake Cookbook suggests</a> that you can tell it a different controller/model/object to provide an authorization procedure by using the <code>$this-&gt;Auth-&gt;authorize</code> variable, however looking at the code (specifically <a href="https://trac.cakephp.org/browser/tags/1.2.4.8284/cake/libs/controller/components/auth.php#L264" rel="nofollow noreferrer">the <code>Auth::startup()</code> function</a>) it looks like Cake will always try to query the database <strong>first</strong>, checking for a matching username/password, before then looking at the alternative object you specified with <code>Auth-&gt;authorize</code>. That is, changing <code>authorize</code> only adds a second-level filter, it doesn't replace the database lookup.</p> <pre><code>// 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. </code></pre> <p>Any ideas on how to do this, hopefully without hacking the core files?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload