Re: Getting the distinguished name when using Auth with the LDAP container
| From: | Sebastian Schneider | Date: | Fri, 05 May 2006 06:24:23 +0000 |
| Subject: | Re: Getting the distinguished name when using Auth with the LDAP container | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23947@lists.php.net to get a copy of this message | ||
Hi Jan!
as we meet each other again here, I'll try to be clearer this time ;-)My intention of posting my problem to the PEAR mailing list has been to reach more people and especially the more experienced people. It's quite funny that I got an answer from YOU on the list. :-)
1. Auth binds as a user, with which it can search the ldap tree 2. It looks for the user, by doing a search defined by your paramters (objectclass, subtree, scope etc.) 3. It eventually finds that user and tries to authenticate with his credentials 4. It then returns true or false The dn it binds with in step 3 is NOT saved anywhere, just used inside the function fetchData.Okay, got it. At first I thought it was saved and I just could not find the member attribute it is stored in.
My suggestion is, that you can fetch additional data from the found object. This would be the attribute dn. So you pass in your options array 'attributes' => array('dn') and it will fetch this attribute. Could be done with username, surname, objectClass or whatever you want. You can then access this data with $auth->getAuthData('attributes'). This is more a rough example than a howto, but it should work. The only problem could be, that you cannot specify dn as an attribute to be fetched. Didn't try that. ... as my first mail bounced, I took time to check on that and dn is not returned. So one would have to change fetchData, to actually save $user_dn in AuthData if 'dn' is in attributes.Yeah, that's the problem. You cannot fetch the DN with getAuthData().
What do the other authors say?Do you know if the Auth developers are subscribed to this list or should I post and subscribe to the PEAR developers list?
Cheers JanCheers Sebastian -- Sebastian Schneider <schneider@dvz.fh-aachen.de> ========================================================== Studentische Hilfskraft in der Netzzentrale der FH Aachen eMail: schneider@dvz.fh-aachen.de Telefon: (+49) 0241 / 6009 24 42 ==========================================================