shaozi / ldap-authentication

🔐🔐🔐 A simple Nodejs Async LDAP authentication library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a method for getting all users?

thedjdoorn opened this issue · comments

This would allow for more specific user management without needing an explicit username or password, something like:

  // auth with admin
  let options = {
    ldapOpts: {
      url: 'ldap://example.com',
      // tlsOptions: { rejectUnauthorized: false }
    },
    adminDn: 'cn=read-only-admin,dc=example,dc=com',
    adminPassword: 'password'
    // starttls: false
  }
  
  let user = await users(options)
  console.log(user)

A query for that would look like "uid=*,ou=people,dc=example,dc=com", I think this could be a great improvement to make the library powerful while also keeping it simple.

I am debating if we should include this feature. The purpose of ldap-authentication is as the name indicates, authenticate a user. Adding getting all users may diverge from that goal.

This feature would be great, I also need it.

Just a note when implementing this: all LDAP servers have a limit how many entries will be returned when doing a simple search() (usually 1000). So when implementing this, add paged: true as option for ldapjs.