shaozi / ldap-authentication

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

Add a method for getting all users? #3

Open thedjdoorn opened 4 years ago

thedjdoorn commented 4 years ago

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.

shaozi commented 4 years ago

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.

mehmetkarakamis commented 3 years ago

This feature would be great, I also need it.

fabiang commented 2 years ago

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.