Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 1x | const _ = require('underscore'); const ldap = require('ldapjs'); const log = require('./service.log'); const getLdapClientOpts = require('./service.getLdapClientOpts'); /** * Factory to create the LDAP client object. * * @private * @param {String} url The url to use when creating the LDAP client. * @param {object} opts The optional LDAP client options. */ const createClient = function(url, opts) { // Attempt to get Url from this instance. url = url || this.url || (this.opts || {}).url || (opts || {}).url; Iif (!url) { throw 'No url specified for ActiveDirectory client.'; } log.trace('createClient(%s)', url); var opts = getLdapClientOpts(_.defaults({}, { url: url }, opts, this.opts)); log.debug('Creating ldapjs client for %s. Opts: %j', opts.url, _.omit(opts, 'url', 'bindDN', 'bindCredentials')); var client = ldap.createClient(opts); return (client); } module.exports = createClient; |