1. Go to this page and download the library: Download rubyan/ldap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* LDAP Configuration.
*
* Contains an array of settings to use for the LDAP configuration.
*
* ## Options
*
* - `domain` - The domain name to match against or auto complete so user isn't
* e returned when
* using closure. You can find your ldap servers with the following command:
* host -t srv _ldap._tcp.YOURDOMAIN.LOCAL
* - `port` - The port to use. Default is 389 and is not ors where key is the error and the value is the error
* message. Set in session to Flash.ldap for flashing
*
* @link http://php.net/manual/en/function.ldap-search.php - for more info on ldap search
*/
'Ldap' => [
'domain' => 'domain.local',
'host' => function() {
$hosts = [
'host1.domain.local',
'host2.domain.local'
];
shuffle($hosts);
return $hosts[0];
},
'port' => 389,
'search' => function($username, $domain) {
if (strpos($username, $domain) !== false) {
// remove the @domain from username
$username = str_replace('@' . $domain, '', $username);
}
$search = '(&(objectCategory=person)(samaccountname=' . $username. '))';
return $search;
},
'baseDN' => function($username, $domain) {
if (strpos($username, $domain) !== false) {
$baseDN = 'OU=Domain,DC=domain,DC=local';
} else {
$baseDN = 'CN=Users,DC=domain,DC=local';
}
return $baseDN;
},
'attributes' => ['samaccountname','mail', 'displayname'],
'errors' => [
'data 773' => 'Some error for Flash',
'data 532' => 'Some error for Flash',
]
],
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.