How to use ldap in UserIdentity for authentication

Comparing #7 with #8

Revision #8 was created by Navarr Navarr on Dec 7, 2013, 1:51:25 AM.

Silence ldap_bind errors

Content

[...]
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connection, LDAP_OPT_REFERRALS, 0);

if($connection)
{
    // Note: in general it is bad to hide errors, however we're checking for an error below
 
$bind = @ldap_bind($connection, "uid={$this->username},ou={$options['ou']},{$dc_string}", $this->password);

if(!$bind) $this->errorCode = self::ERROR_PASSWORD_INVALID;
else $this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
[...]