jsumners / node-activedirectory

ActiveDirectory is an Node.js ldapjs client for authN (authentication) and authZ (authorization) for Microsoft Active Directory with range retrieval support for large Active Directory installations. Originally forked from gheeres/node-activedirectory.
MIT License
52 stars 43 forks source link

If you want to specify your own parser you can override the default parser as follows: #95

Open thomascouto opened 3 years ago

thomascouto commented 3 years ago

From DOC:

If you want to specify your own parser you can override the default parser as follows:

const ad = new ActiveDirectory({ url: 'ldap://dc.domain.com',
                               baseDN: 'dc=domain,dc=com',
                               username: 'username@domain.com',
                               password: 'password',
                               attributes: {
                                   user: ['dn']
                              }      
});

I get the error:

Type '["dn"]' is not assignable to type '["dn", "distinguishedName", "userPrincipalName", "sAMAccountName", "mail", "lockoutTime", "whenCreated", "pwdLastSet", "userAccountControl", "employeeID", "sn", "givenName", ... 4 more ..., "description"]'.

Is it a bug ? Thanks

dvaghela commented 2 years ago

I think you might be using the Types from @types/activedirectory2. It has loaded some types by default and prevents such overriding.

Two options:

  1. If you can, just remove the @types/activedirectoy2 package from your project and try again. You won't get the typings but such overriding will work.
  2. Just add the attribute you are looking for in the index file (where the attributes are defined) of the @types/activedirectory2 package in your node_modules folder.