PHP, LDAP and Windows Integrated Authentication
| From: | Break | Date: | Thu, 11 Sep 2008 14:43:18 +0000 |
| Subject: | PHP, LDAP and Windows Integrated Authentication | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-29029@lists.php.net to get a copy of this message | ||
Good morning all,
System platform:
Server with W2K3, IIS6 and PHP 5
Workstation with XP SP3.
I make a search into my LDAP.
It works but I need to make the bind with a username/password couple
Code below:
<?php
$ldap_user = substr($_SERVER['AUTH_USER'],7)."@domaine.com";
$ldap_pass); //here putting the password for ^$ldap_user;
$ldap_host = 'ldap.domaine.com';
$ldap_domain= 'ldap-domain';
$base_dn='ou=USER,OU=OrgUnit,dc=domain,dc=com';
$filter='(cn=*)';
$connect=ldap_connect($ldap_host,389) or exit('>>Could not connect to LDAP
server<<');
$bind=ldap_bind($connect,$ldap_user,$ldap_pass) or exit('<<Could not bind to
$ldap_host<<');
$read=ldap_search($connect,$base_dn,$filter);
$info=ldap_get_entries($connect,$read);
echo $info['count'].' entries returned<p>';
echo "<br>";
for ($i=0;$i<$info['count']; $i++)
{
$info_cn = $info[$i]['initials'][0];
echo 'cn = '.$info_cn.'<BR>';
}
?>
I want use the Windows Integrated Authentication to send to my ldap_bind command the current
user/password instead of hardcoded it into the php script.
Regards,
C.B