I’ve published my Active Directory authentication (AuthN) and authorization (AuthZ) module for node.js. This module supports large active directory installation where over 1000 entries may be returned from a query via range specifiers. In addition, the module will recursively enumerate and expand all nested users and groups.
You can view or checkout the code online on my github account:
Installation is easy with npm:
1 | npm install activedirectory |
Usage is pretty simple:
1 2 3 4 5 6 7 8 9 10 11 | var ad = new ActiveDirectory( 'ldap://yourdomain.com' , 'dc=yourdomain,dc=com' , 'authuser@domain.com' , 'authpassword' ); var username = 'bob@domain.com' ; ad.findUser(username, function (err, user) { if (err) { console.log( 'ERROR: ' +JSON.stringify(err)); return ; } if (! user) console.log( 'User: ' + username + ' not found.' ); else console.log(JSON.stringify(user)); }); |
Hope you find it useful!