shaozi / ldap-authentication

🔐🔐🔐 A simple Nodejs Async LDAP authentication library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Group has null instead of the group

MalfuncEddie opened this issue · comments

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 :)

not an ldap-authentication issue.