MCPcopy
hub / github.com/openstf/stf / tryConnect

Function tryConnect

lib/util/ldaputil.js:20–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18// Export
19module.exports.login = function(options, username, password) {
20 function tryConnect() {
21 var resolver = Promise.defer()
22 var client = ldap.createClient({
23 url: options.url
24 , timeout: options.timeout
25 , maxConnections: 1
26 })
27
28 if (options.bind.dn) {
29 client.bind(options.bind.dn, options.bind.credentials, function(err) {
30 if (err) {
31 resolver.reject(err)
32 }
33 else {
34 resolver.resolve(client)
35 }
36 })
37 }
38 else {
39 resolver.resolve(client)
40 }
41
42 return resolver.promise
43 }
44
45 function tryFind(client) {
46 var resolver = Promise.defer()

Callers 1

ldaputil.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected