shaozi / ldap-authentication

🔐🔐🔐 A simple Nodejs Async LDAP authentication library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

groups:[undefined]

wesley3295 opened this issue · comments

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?

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 #56 and this commit daf760b.

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.