Skip to content

Commit

Permalink
Merge pull request #12 from vesse/enable-tls-options
Browse files Browse the repository at this point in the history
Enable tlsOptions, timeout and connectTimeout options
  • Loading branch information
trentm committed Aug 26, 2013
2 parents b0529d6 + dd46551 commit 32c283a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MIT. See "LICENSE" file.

# `LdapAuth` Config Options

[Use the source Luke](https://github.com/trentm/node-ldapauth/blob/master/lib/ldapauth.js#L25-45)
[Use the source Luke](https://github.com/trentm/node-ldapauth/blob/master/lib/ldapauth.js#L25-53)


# express/connect basicAuth example
Expand Down
17 changes: 17 additions & 0 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ var format = require('util').format;
* this will add TRACE-level logging for ldapjs (quite verbose).
* cache {Boolean} Optional, default false. If true, then up to 100
* credentials at a time will be cached for 5 minutes.
* timeout {Integer} Optional, default Infinity. How long the client should
* let operations live for before timing out.
* connectTimeout {Integer} Optional, default is up to the OS. How long the
* client should wait before timing out on TCP connections.
* tlsOptions {Object} Additional options passed to the TLS connection layer
* when connecting via ldaps://. See
* http://nodejs.org/api/tls.html#tls_tls_connect_options_callback
* for available options
*/
function LdapAuth(opts) {
this.opts = opts;
Expand All @@ -60,6 +68,15 @@ function LdapAuth(opts) {
if (opts.log4js && opts.verbose) {
clientOpts.log4js = opts.log4js;
}
if (opts.timeout) {
clientOpts.timeout = opts.timeout;
}
if (opts.connectTimeout) {
clientOpts.connectTimeout = opts.connectTimeout;
}
if (opts.tlsOptions) {
clientOpts.tlsOptions = opts.tlsOptions;
}
this._adminClient = ldap.createClient(clientOpts);
this._adminBound = false;
this._userClient = ldap.createClient(clientOpts);
Expand Down

0 comments on commit 32c283a

Please sign in to comment.