shaozi / ldap-authentication

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

Group has null instead of the group #59

Closed MalfuncEddie closed 11 months ago

MalfuncEddie commented 11 months ago

Hi,

I come here form another project that is using this packages. Given the following ldap search I get the groups userA is member of

ldapsearch -x -H ldap://xxx.xxx.xxx.xxx -D cn='yyyy' -w zzzzzz -s sub "(&(objectclass=groupOfNames)(memberUid=userA))"

# extended LDIF
#
# LDAPv3
# base <> (default) with scope subtree
# filter: (&(objectclass=groupOfNames)(memberUid=userA))
# requesting: ALL
#

# Found Group, General, Groups, Company wide, domainy.domainface
dn: CN=Found Group,OU=General,OU=Groups,OU=Company wide,DC=bla,DC=blah
objectClass: top
objectClass: posixGroup
objectClass: groupOfNames
gidNumber: 50289
cn: Found Group
memberUid: userA
memberUid: userB

member: CN=User A,OU=iii,OU=Users,OU=Company wide,DC=bla,DC=blah
member: CN=User B,OU=iii,OU=Users,OU=Company wide,DC=bla,DC=blah

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

However when dumping the return object of the authenticate I get null as groups.

{
  "dn": "censored",
  "objectClass": [
    "shadowAccount",
    "posixAccount",
    "top",
    "organizationalPerson",
    "person",
    "inetOrgPerson"
  ],
  ....
  "gidNumber": "54321",
  "uidNumber": "12345",
  "uid": "xxx",
  "groups": [null ]
}

I would expect "groups": ["Found Group"] If there are more results it is "groups": [null,null,null .... ]

JS is not a language I am familiar with so if someone could explain me how the groups are extracted from the result I can start debugging it :)

MalfuncEddie commented 11 months ago

not an ldap-authentication issue.