jsumners / node-activedirectory

ActiveDirectory is an Node.js ldapjs client for authN (authentication) and authZ (authorization) for Microsoft Active Directory with range retrieval support for large Active Directory installations. Originally forked from gheeres/node-activedirectory.
MIT License
52 stars 43 forks source link

Find Users ERROR #90

Open DardoJav opened 3 years ago

DardoJav commented 3 years ago

Hi All,

I'm getting an ERROR trying to run the findUsers() to get more than 500 users When I run he app for the first time it gives me all the users, but in the next calls it return with an error:

Error: Client network socket disconnected before secure TLS connection was established at connResetException (internal/errors.js:613:14) at TLSSocket.onConnectEnd (_tls_wrap.js:1532:19) at Object.onceWrapper (events.js:421:28) at TLSSocket.emit (events.js:327:22) at TLSSocket.EventEmitter.emit (domain.js:485:12) at endReadableNT (_stream_readable.js:1201:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) { code: 'ECONNRESET', path: undefined, host: 'XX.XXX.XX.XXX', port: XXX, localAddress: undefined }

this is the code part:

const AD = require('activedirectory2').promiseWrapper const config = { url: 'ldaps://XX.XXX.XX.XXX:XXX', baseDN: 'DC=XXXXXX,DC=XXXXX', username: 'dardo.luna', password: 'xxxxxxxxx', } const ad = new AD(config)

var opts = {
  scope: 'sub',
  filter: '(&(objectCategory=User)(objectCategory=Person))', 
}

const results = await ad.findUsers(opts, true)

Tried the authenticate method and authenticates correctly But don't know what I'm doing wrong here in the find users part

Please help Thanks!

jurjendijkstra commented 3 years ago

I don't think ad.findUsers needs two parameters. Can you try ad.findUsers(opts) instead (opts, true) ?