shaozi / ldap-authentication

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

groups:[undefined] #62

Open wesley3295 opened 8 months ago

wesley3295 commented 8 months ago

SPECS: ldap-authentication: ^3.0.3 node: 20.5.0

CODE:

const ldapOptions = {
    ldapOpts: {
      url: process.env.LDAP_URL,
      tlsOptions: { rejectUnauthorized: false },
      connectTimeout: 20000,
    },
    starttls: true,
    userDn: `${process.env.LDAP_USERNAME_ATTRIBUTE}=${body.username},${process.env.LDAP_USER_SEARCH_BASE}`,
    userPassword: body.password,
    userSearchBase: process.env.LDAP_USER_SEARCH_BASE,
    usernameAttribute: process.env.LDAP_USERNAME_ATTRIBUTE,
    username: body.username,
    groupsSearchBase:"ou=groups,dc=dev,dc=companyName,dc=com",
    groupClass  :"groupOfNames",
    groupMemberAttribute :"member",
  };

ISSUE: I am currently updating the ldap-authentication dep from 2.3.1 to 3.0.3. When converting the dep my response from ldap is mainly the same except my groups property is an Array with undefined inside. I have tried following docs to no avail. What am I missing here?

EmilienLeroy commented 7 months ago

Hi @wesley3295

I'm encountering the same problem you are facing, and it seems that these issues have been fixed but the changes have not yet been released. You can refer to this issue https://github.com/shaozi/ldap-authentication/issues/56 and this commit https://github.com/shaozi/ldap-authentication/commit/daf760bbb250cec6cb84209b3d05211a882e8aa6.

If you wish to use this updated version, you can include the following line in your package.json:

"ldap-authentication": "https://github.com/shaozi/ldap-authentication.git#daf760bbb250cec6cb84209b3d05211a882e8aa6"

This will directly download the library from GitHub.

shaozi commented 5 months ago

I pushed a latest release 3.1.0 to npm. Can you try to see if the fix is there?