The \NObjects\Ldap\Service class does not provide a way to specify the maximum desired amount of time to wait before aborting due to a network timeout (e.g.: the ldap server is unreachable), and the defaults are painfully long (>100 seconds in some cases).
This pull request leverages the LDAP_OPT_NETWORK_TIMEOUT option to allow for programmatic specification of an amount of time to wait before aborting.
Example usage:
$options = array(
'host' => $settings['host'],
'defaultUsername' => $settings['username'],
'defaultPassword' => $settings['password'],
);
$ldapService = new \NObjects\Ldap\Service($options);
$ldapService->setNetworkTimeout(5); // <-- specify a maximum wait time of 5 seconds
$ldapUser = \NObjects\Ldap\User::authenticate($username, $password, $ldapService);
Tests are included to verify proper behavior of the added getters/setters.
The
\NObjects\Ldap\Service
class does not provide a way to specify the maximum desired amount of time to wait before aborting due to a network timeout (e.g.: the ldap server is unreachable), and the defaults are painfully long (>100 seconds in some cases).This pull request leverages the LDAP_OPT_NETWORK_TIMEOUT option to allow for programmatic specification of an amount of time to wait before aborting.
Example usage:
Tests are included to verify proper behavior of the added getters/setters.