<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: LdapAuth component for CakePHP</title>
	<atom:link href="http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/</link>
	<description>If I have seen a little further it is by standing on the shoulders of Giants. - Newton</description>
	<lastBuildDate>Wed, 30 Jun 2010 21:07:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Jay</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-1058</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Tue, 01 Jun 2010 14:35:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-1058</guid>
		<description>I&#039;m trying to use your ldap_auth (which is pretty slick, by the way)...but I&#039;m having a problem in which the ldap lookup is getting sent a full array instead of the username during login, resulting in a login failure.  I&#039;m not sure how that&#039;s happening, but could use some help</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to use your ldap_auth (which is pretty slick, by the way)&#8230;but I&#8217;m having a problem in which the ldap lookup is getting sent a full array instead of the username during login, resulting in a login failure.  I&#8217;m not sure how that&#8217;s happening, but could use some help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: analogrithems</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-1051</link>
		<dc:creator>analogrithems</dc:creator>
		<pubDate>Sun, 23 May 2010 18:19:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-1051</guid>
		<description>I added a new attribute that needs to be added to the database config,  Here is my database.php  This is to make the datasource work with different ldap servers operational attributes and know how to find the schemas that exists in different locations between them.

vi config/core.php
&lt;pre&gt;
&lt;?php
 class DATABASE_CONFIG {
        //This will be used for extensions/plugins.  if you plugin needs a db, define it here.
        var $default = array(
                &#039;driver&#039; =&gt; &#039;mysql&#039;,
                &#039;persistent&#039; =&gt; false,
                &#039;host&#039; =&gt; &#039;localhost&#039;,
                &#039;login&#039; =&gt; &#039;user&#039;,
                &#039;password&#039; =&gt; &#039;password&#039;,
                &#039;database&#039; =&gt; &#039;database_name&#039;,
                &#039;prefix&#039; =&gt; &#039;&#039;,
        );
        var $ldap = array (
                &#039;datasource&#039; =&gt; &#039;ldap&#039;,
                &#039;host&#039; =&gt; &#039;localhost&#039;,
                &#039;port&#039; =&gt; 389,
                &#039;basedn&#039; =&gt; &#039;dc=analogrithems,dc=com&#039;,
                &#039;login&#039; =&gt; &#039;&#039;,     //For Proxy Userdn
                &#039;password&#039; =&gt; &#039;&#039;,  //For Proxy UserDN password
                &#039;database&#039; =&gt; &#039;&#039;,  //Needed to prevent cakePHP from throwing errors about database missing
                &#039;tls&#039; =&gt; &#039;&#039;, //Set this to true if using tls
                &#039;type&#039; =&gt; &#039;Netscape&#039;, //Type Can be either &#039;Netscape&#039;, &#039;OpenLDAP&#039;, &#039;ActiveDirectory&#039;
                &#039;version&#039; =&gt; 3 //LDAP Version 3
         );
 }
?&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I added a new attribute that needs to be added to the database config,  Here is my database.php  This is to make the datasource work with different ldap servers operational attributes and know how to find the schemas that exists in different locations between them.</p>
<p>vi config/core.php</p>
<pre>
< ?php
 class DATABASE_CONFIG {
        //This will be used for extensions/plugins.  if you plugin needs a db, define it here.
        var $default = array(
                'driver' => 'mysql',
                'persistent' => false,
                'host' => 'localhost',
                'login' => 'user',
                'password' => 'password',
                'database' => 'database_name',
                'prefix' => '',
        );
        var $ldap = array (
                'datasource' => 'ldap',
                'host' => 'localhost',
                'port' => 389,
                'basedn' => 'dc=analogrithems,dc=com',
                'login' => '',     //For Proxy Userdn
                'password' => '',  //For Proxy UserDN password
                'database' => '',  //Needed to prevent cakePHP from throwing errors about database missing
                'tls' => '', //Set this to true if using tls
                'type' => 'Netscape', //Type Can be either 'Netscape', 'OpenLDAP', 'ActiveDirectory'
                'version' => 3 //LDAP Version 3
         );
 }
?>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Traynor</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-1047</link>
		<dc:creator>Sean Traynor</dc:creator>
		<pubDate>Fri, 14 May 2010 14:23:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-1047</guid>
		<description>Hi Analogrithems,

Firstly - thank you for this article and all of your efforts towards CakePHP&#039;s LDAP integration!

I am having issues however. If I use the ldap_source listed in the article LDAP is properly queried however I have the issues above with blank output without debug and header already sent with debug on.

With the latest version of ldap_source on github I recieve the message &quot;-1: Can&#039;t contact LDAP server&quot; - even though it works with the older version of ldap_source! Are there any changes that need to be made to the LdapAuth component to make it compatible with the latest version of the ldap_source datasource?

Many thanks!
Sean</description>
		<content:encoded><![CDATA[<p>Hi Analogrithems,</p>
<p>Firstly &#8211; thank you for this article and all of your efforts towards CakePHP&#8217;s LDAP integration!</p>
<p>I am having issues however. If I use the ldap_source listed in the article LDAP is properly queried however I have the issues above with blank output without debug and header already sent with debug on.</p>
<p>With the latest version of ldap_source on github I recieve the message &#8220;-1: Can&#8217;t contact LDAP server&#8221; &#8211; even though it works with the older version of ldap_source! Are there any changes that need to be made to the LdapAuth component to make it compatible with the latest version of the ldap_source datasource?</p>
<p>Many thanks!<br />
Sean</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-1016</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Wed, 03 Mar 2010 22:34:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-1016</guid>
		<description>You may want to consider adding the following to your component so that the Auth examples from the book still work as described.

  /**
   * Initialize method ensures Auth methods remain working as described in the book.
   */
  function initialize(&amp;$controller) {
      parent::initialize($controller);
      $controller-&gt;Auth =&amp; $this;
  }

Now every reference to $this-&gt;Auth is still valid.</description>
		<content:encoded><![CDATA[<p>You may want to consider adding the following to your component so that the Auth examples from the book still work as described.</p>
<p>  /**<br />
   * Initialize method ensures Auth methods remain working as described in the book.<br />
   */<br />
  function initialize(&amp;$controller) {<br />
      parent::initialize($controller);<br />
      $controller-&gt;Auth =&amp; $this;<br />
  }</p>
<p>Now every reference to $this-&gt;Auth is still valid.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kit Peters</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-983</link>
		<dc:creator>Kit Peters</dc:creator>
		<pubDate>Mon, 16 Nov 2009 23:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-983</guid>
		<description>it&#039;s worth noting that the call to __getLDAPSchema() will fail if you bind anonymously to an Active Directory 2003 server (see http://serverfault.com/questions/10208/disable-requiring-authentication-to-bind-in-active-directory).  You can turn this behavior off in AD, but if you don&#039;t have access to the AD configuration, you&#039;ll have to do a bind with a username/password.</description>
		<content:encoded><![CDATA[<p>it&#8217;s worth noting that the call to __getLDAPSchema() will fail if you bind anonymously to an Active Directory 2003 server (see <a href="http://serverfault.com/questions/10208/disable-requiring-authentication-to-bind-in-active-directory)" rel="nofollow">http://serverfault.com/questions/10208/disable-requiring-authentication-to-bind-in-active-directory)</a>.  You can turn this behavior off in AD, but if you don&#8217;t have access to the AD configuration, you&#8217;ll have to do a bind with a username/password.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: analogrithems</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-975</link>
		<dc:creator>analogrithems</dc:creator>
		<pubDate>Tue, 13 Oct 2009 00:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-975</guid>
		<description>in the getDN function did you have to change the call to look for an attribute besides uid?  I recall windows uses something different like userPrincipal.  Can you post your code changes so i can make this component more universal?</description>
		<content:encoded><![CDATA[<p>in the getDN function did you have to change the call to look for an attribute besides uid?  I recall windows uses something different like userPrincipal.  Can you post your code changes so i can make this component more universal?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Parr</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-974</link>
		<dc:creator>Shawn Parr</dc:creator>
		<pubDate>Fri, 09 Oct 2009 15:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-974</guid>
		<description>I got your auth working.  A couple odd things were happening.  For some reason on our AD domain, when just searching you can specify the root (dc=example, dc=edu) and it will find everything, however when using authentication it fails.  This is especially weird since it is in the getDn function:  $userObj$ = $this-&gt;ldap-&gt;find, which I would have imagined should work since it is seemingly identical to the code that does it when just doing lookups.

To make things weirder, when that failed, it was returning nothing, which then got passed on to ldapauth, which for some reason would return 1 to the login function when the dn was empty.  So I had a situation where anyone could log in with any username/password combo.

To solve this I first changed the getDn function to individually search the two OU&#039;s set up in our AD where all valid users are stored (in sub OU&#039;s).  I then added a statement to ldapauth to return a zero if the dn was empty.

Technically the above getDn change I had already implemented in my controller and model due to the fact that our AD has a lot of extra stuff in many of the object records.  As such a typical search someone would setup for ldap will return computer records and other special items (computers are tagged with objectclass=person for some odd reason), so I added a new line to the model that uses an array to hold multiple OU statements, then use a foreach loop to go through them, then a bit of logic to deal with getting the results back to something the system can deal with as it is.

I want to thank you for:
1) creating these ldap tools. They work well, and are pretty well thought out
2) for creating full documentation for how to do something in cakephp.

That second one is really what I appreciate most.  As I start learning cakephp I tend to find plenty of articles and info on how to do things, but almost all of them require a pretty full knowledge of the logic behind cakephp.  Having an article like this to reference which gives full working examples was EXTREMELY helpful.</description>
		<content:encoded><![CDATA[<p>I got your auth working.  A couple odd things were happening.  For some reason on our AD domain, when just searching you can specify the root (dc=example, dc=edu) and it will find everything, however when using authentication it fails.  This is especially weird since it is in the getDn function:  $userObj$ = $this-&gt;ldap-&gt;find, which I would have imagined should work since it is seemingly identical to the code that does it when just doing lookups.</p>
<p>To make things weirder, when that failed, it was returning nothing, which then got passed on to ldapauth, which for some reason would return 1 to the login function when the dn was empty.  So I had a situation where anyone could log in with any username/password combo.</p>
<p>To solve this I first changed the getDn function to individually search the two OU&#8217;s set up in our AD where all valid users are stored (in sub OU&#8217;s).  I then added a statement to ldapauth to return a zero if the dn was empty.</p>
<p>Technically the above getDn change I had already implemented in my controller and model due to the fact that our AD has a lot of extra stuff in many of the object records.  As such a typical search someone would setup for ldap will return computer records and other special items (computers are tagged with objectclass=person for some odd reason), so I added a new line to the model that uses an array to hold multiple OU statements, then use a foreach loop to go through them, then a bit of logic to deal with getting the results back to something the system can deal with as it is.</p>
<p>I want to thank you for:<br />
1) creating these ldap tools. They work well, and are pretty well thought out<br />
2) for creating full documentation for how to do something in cakephp.</p>
<p>That second one is really what I appreciate most.  As I start learning cakephp I tend to find plenty of articles and info on how to do things, but almost all of them require a pretty full knowledge of the logic behind cakephp.  Having an article like this to reference which gives full working examples was EXTREMELY helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Parr</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-972</link>
		<dc:creator>Shawn Parr</dc:creator>
		<pubDate>Tue, 06 Oct 2009 20:59:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-972</guid>
		<description>I got your ldap_source working, and can do lookups against our Active Directory setup.  However I just can&#039;t get this component to work at all.

I&#039;d like to give more info, but I&#039;m getting the infamous &#039;Cannot modify header information - headers already sent by&#039; error.  I&#039;ve done my research, and typically that is caused by white space after the ?&gt; tag, but I&#039;ve searched all my files and do not have any with the extra whitespace outside of my view template files.

That being said, the one page that does load is my login page /users/login.  When it is submitted I get the following on my mostly blank page:

1	search &#124; scope: sub &#124; cond: samaccountname=user &#124; targetDn: dc=example,dc=com &#124; order: 	1: Operations error	

I&#039;m pretty sure that Operations error is an issue, but I&#039;m not sure what is causing it.  I have a bind user and password set in my Ldap config in the database config file, and they are obviously working since ldap lookups work fine (trust me, if the bind user can&#039;t connect the lookups wouldn&#039;t work!).

Any ideas?  Any pointers?  I&#039;m going nuts trying to figure this out.  Feel free to email me if you want more details or have other instructions.

I should note that I&#039;m pretty new to cakephp, but have done a little bit of MVC php development.</description>
		<content:encoded><![CDATA[<p>I got your ldap_source working, and can do lookups against our Active Directory setup.  However I just can&#8217;t get this component to work at all.</p>
<p>I&#8217;d like to give more info, but I&#8217;m getting the infamous &#8216;Cannot modify header information &#8211; headers already sent by&#8217; error.  I&#8217;ve done my research, and typically that is caused by white space after the ?&gt; tag, but I&#8217;ve searched all my files and do not have any with the extra whitespace outside of my view template files.</p>
<p>That being said, the one page that does load is my login page /users/login.  When it is submitted I get the following on my mostly blank page:</p>
<p>1	search | scope: sub | cond: samaccountname=user | targetDn: dc=example,dc=com | order: 	1: Operations error	</p>
<p>I&#8217;m pretty sure that Operations error is an issue, but I&#8217;m not sure what is causing it.  I have a bind user and password set in my Ldap config in the database config file, and they are obviously working since ldap lookups work fine (trust me, if the bind user can&#8217;t connect the lookups wouldn&#8217;t work!).</p>
<p>Any ideas?  Any pointers?  I&#8217;m going nuts trying to figure this out.  Feel free to email me if you want more details or have other instructions.</p>
<p>I should note that I&#8217;m pretty new to cakephp, but have done a little bit of MVC php development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: analogrithems</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-907</link>
		<dc:creator>analogrithems</dc:creator>
		<pubDate>Mon, 13 Jul 2009 20:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-907</guid>
		<description>This shouldn&#039;t be an issue, make it use the ldap datasource http://www.analogrithems.com/rant/2009/06/12/cakephp-with-full-crud-a-living-example/  then add the auth componet in this article.  In your config/database.php place an entry for you active directory stuff. like any normal ldap connection.  Active directory is just a standard ldap v3 (mostly).  Also i believe you must use a proxy user account in your &#039;config/database.php&#039; file for the inital dn lookup. (When you type in your username the script needs to translate that to a dn, it uses the proxy account you initially specify in config/database.php login &amp; password fields to do the inital lookup then binds with the returned dn and the password you passed.) 

The only other thing I can think of is changing the attribute on line 156
`$dn = $this-&gt;getDn(&#039;uid&#039;, $uid);` to `$dn = $this-&gt;getDn(&#039;samaccountname&#039;, $uid);` if you want to use a regular username format
of change it to `$dn = $this-&gt;getDn(&#039;userprincipalname&#039;, $uid);` if you are going to use username@domain format

see http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm

Let me know if you have any trouble and I&#039;ll to try to drum up an AD server to test my code against.</description>
		<content:encoded><![CDATA[<p>This shouldn&#8217;t be an issue, make it use the ldap datasource <a href="http://www.analogrithems.com/rant/2009/06/12/cakephp-with-full-crud-a-living-example/" rel="nofollow">http://www.analogrithems.com/rant/2009/06/12/cakephp-with-full-crud-a-living-example/</a>  then add the auth componet in this article.  In your config/database.php place an entry for you active directory stuff. like any normal ldap connection.  Active directory is just a standard ldap v3 (mostly).  Also i believe you must use a proxy user account in your &#8216;config/database.php&#8217; file for the inital dn lookup. (When you type in your username the script needs to translate that to a dn, it uses the proxy account you initially specify in config/database.php login &amp; password fields to do the inital lookup then binds with the returned dn and the password you passed.) </p>
<p>The only other thing I can think of is changing the attribute on line 156<br />
`$dn = $this-&gt;getDn(&#8216;uid&#8217;, $uid);` to `$dn = $this-&gt;getDn(&#8216;samaccountname&#8217;, $uid);` if you want to use a regular username format<br />
of change it to `$dn = $this-&gt;getDn(&#8216;userprincipalname&#8217;, $uid);` if you are going to use username@domain format</p>
<p>see <a href="http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm" rel="nofollow">http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm</a></p>
<p>Let me know if you have any trouble and I&#8217;ll to try to drum up an AD server to test my code against.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://www.analogrithems.com/rant/2009/06/13/ldapauth-component-for-cakephp/comment-page-1/#comment-901</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Wed, 08 Jul 2009 15:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=40#comment-901</guid>
		<description>Very cool component.  I need to write a tiny cake-based app this week and need to authenticate users via Microsoft Active directory.  I also want to lock down the app to allow only users in a certain group to use any of it.  Any suggestions on where to add that logic?  I&#039;m a bit new to cake and have been picking things up via the manual.

Thank You,</description>
		<content:encoded><![CDATA[<p>Very cool component.  I need to write a tiny cake-based app this week and need to authenticate users via Microsoft Active directory.  I also want to lock down the app to allow only users in a certain group to use any of it.  Any suggestions on where to add that logic?  I&#8217;m a bit new to cake and have been picking things up via the manual.</p>
<p>Thank You,</p>
]]></content:encoded>
	</item>
</channel>
</rss>
