shaozi / ldap-authentication

🔐🔐🔐 A simple Nodejs Async LDAP authentication library
BSD 2-Clause "Simplified" License
108 stars 28 forks source link

Active Directory #1

Open k0dsubs opened 4 years ago

k0dsubs commented 4 years ago

Hi,

There seems to be an issue when authenticating against microsoft active directory, using one of the two examples (the one without mongodb), I can see that it finds the user in the active directory (by running console.log(user) ) and pulls all the information but it doesn't seem to send the "success" flag, therefore, it returns to the main page?

using the following configuration

  adminDn: 'cn=Administrator,cn=Users,dc=xxxx,dc=local',
        adminPassword: 'xxxxx',
        userPassword: req.body.password,
        userSearchBase: 'ou=IT,dc=xxxxx,dc=local',
        usernameAttribute: 'sAMAccountName',
        username: req.body.username

      }
      // ldap authenticate the user
      let user = await authenticate(options)
    console.log(user)

      // success
      done(null, user) <- seems to fail here
shaozi commented 4 years ago

Sorry just noticed this. What do you mean by not send the success flag?

shaozi commented 4 years ago

This library just get the user details from LDAP. If you are using passport, you can check this code for how to integrate the library in passport.

https://github.com/shaozi/express-passport-ldap-mongoose/blob/95db724878c62e4ce8336573649c613514ce7ecf/index.js#L87