auth0 / passport-windowsauth

Windows Authentication strategy for Passport.js
MIT License
178 stars 54 forks source link

LDAPS Error #29

Closed sentientcucumber closed 8 years ago

sentientcucumber commented 9 years ago

When trying to connect via LDAPS, I get the following error:

  closeSocket.on('close', function onClose(had_err) {
             ^
TypeError: Cannot read property 'on' of undefined
    at setupSocket (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\lib\client\client.js:111:14)
    at Client._connect (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\lib\client\client.js:742:3)
    at new Client (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\lib\client\client.js:247:22)
    at Pool.createClient [as create] (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\lib\client\pool.js:45:20)
    at Pool._create (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\node_modules\pooling\lib\pool.js:416:14)
    at Pool.acquire (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\node_modules\pooling\lib\pool.js:258:14)
    at C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\lib\client\pool.js:255:22
    at f (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\node_modules\pooling\node_modules\once\once.js:16:25)
    at end (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\node_modules\ldapjs\node_modules\pooling\lib\pool.js:351:17)
    at process._tickCallback (node.js:355:11)

As seen in the stacktrace, ldapjs is throwing this and currently has an open issue. Reading through the issue, its fixed in commit acc1ca8f43. But the fun doesn't stop there.

I installed the node module at the given commit and attempted to run again. This caused the following error

ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_D;
                                    ^
TypeError: Cannot set property 'guid_format' of undefined
    at Object.<anonymous> (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\lib\LdapLookup.js:2:37)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\U454243\development\vagrant\code\dashboardPassport\node_modules\passport-windowsauth\lib\strategy.js:6:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

It appears settings is no longer defined. I'm not sure where or how this gets used, I commented out the line (What could go wrong?) and everything worked afterwards.

If someone can confirm this is a bug and not just me, then I'd be more than happy to submit a PR addressing the issues.

Mctalian commented 9 years ago

+1 I am also having this issue

Mctalian commented 8 years ago

@shellhead I forked this and submitted a PR. Also tagged a release on my fork if you're interested and still need a solution.