{"_id":"@brandom/passport-activedirectory","name":"@brandom/passport-activedirectory","dist-tags":{"latest":"1.3.0"},"versions":{"1.3.0":{"name":"@brandom/passport-activedirectory","version":"1.3.0","description":"Active Directory strategy for passport.js","license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/bhoriuchi/passport-activedirectory.git"},"scripts":{"build:copybrc":"cp build/.build.babelrc src/.babelrc","build:rmbrc":"rm -f src/.babelrc","build":"npm run build:copybrc && rollup -c build/rollup.config.js && npm run build:rmbrc"},"author":{"name":"Branden Horiuchi","email":"bhoriuchi@gmail.com"},"dependencies":{"activedirectory2":"^2.1.0","passport":"^0.6.0"},"devDependencies":{"rollup":"^0.34.10","rollup-plugin-babel":"^2.6.1","babel-preset-es2015-rollup":"^3.0.0"},"bugs":{"url":"https://github.com/bhoriuchi/passport-activedirectory/issues"},"homepage":"https://github.com/bhoriuchi/passport-activedirectory#readme","directories":{"example":"example"},"keywords":["passport","active","directory","ad","ldap","authentication","strategy"],"gitHead":"a7849b02484340dc1f287f85dca27de1153adef5","_id":"@brandom/passport-activedirectory@1.3.0","_nodeVersion":"18.14.0","_npmVersion":"9.4.2","dist":{"integrity":"sha512-6sFy/nlGzHXS3PJhByfe1yM/gY6j10AoIe/ebXMUz2OErtizz+HoIUpZBIaZhNgc7UzW4KHN/jc3L2xdtfg7IA==","shasum":"2280fae95892af4993b28c44f75f83d7cdbd46ed","tarball":"https://registry.npmjs.org/@brandom/passport-activedirectory/-/passport-activedirectory-1.3.0.tgz","fileCount":3,"unpackedSize":11386,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCTEq7DCSQPjkKbQoPE6jvCL3JxMqNr4RZ6bD/8kd8RjQIgb+qhGV3BsaUqXlI9EgN51UyKDeeEBNyIkr8noUnGrfE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7FdqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7jA/9GgH2nO22KTpfTiCp3AJ6kpaFLO49l2/wODSfVTbA1KqYT7g+\r\nI2/YHQnXLNSIByL7KXu0rfJAhfNAwQmhR4OB9305cAc+ERC2dE3KYzqAMuxl\r\nk/FgiwMw/Zy0x4KXwxN2V+EQ3fACQGXiulJ2zMA7AYE4Fx7WUhZ91lGELUnL\r\nL01U5uYgo7+yLFplneyjvA2DMFiSHBSMQoDGKkZBrC7hDtdJ18gpvPEAS7ts\r\n2jrJXNpR1RBRGmNsYRG67kRnnD0sS4f+gskepF8RkIiuOf0QgANsjUHnK+NU\r\nFsg6c/0ync1MQpgQybHhx1JxJwlSXQSnEkcxoBScEdE+0gUbe2dXKlxOliGf\r\n7VYTXemqm61B8hleOEe+HNFTp3PIAqHJ1JBMMDgocgn1mD7mmZ//YmY3VlUo\r\njjbvoc8FgfnlsMc6MaYcy2dpsnnsU/WbVzzSGEaCObXGTInBlnTBD4TVvBMT\r\ndIiAG9cJcg+ygZmqQ+YkM/1B/n+AKdGjRgMYlKni61x2jJnkChBwIP58gDkN\r\np3pXtxzQZYT6+cM7qjFXI4IXSXll1PtP1FBmsw8SrRRi3cZRxG/XwiduL05+\r\necSKWI20l/5dJ6hrwVKTyHAYPqwxJOggXCVwkjRL44gwxdsKrzVIw+XEcLLa\r\nngsG44cM6C5H1vQ5lx6c/Sa4b81MeKDxDAQ=\r\n=+9SE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"brandom","email":"brandom.v@gmail.com"},"maintainers":[{"name":"brandom","email":"brandom.v@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-activedirectory_1.3.0_1676433258790_0.2095821716640327"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-15T03:54:18.716Z","1.3.0":"2023-02-15T03:54:18.929Z","modified":"2023-02-15T03:54:19.112Z"},"maintainers":[{"name":"brandom","email":"brandom.v@gmail.com"}],"description":"Active Directory strategy for passport.js","homepage":"https://github.com/bhoriuchi/passport-activedirectory#readme","keywords":["passport","active","directory","ad","ldap","authentication","strategy"],"repository":{"type":"git","url":"git+https://github.com/bhoriuchi/passport-activedirectory.git"},"author":{"name":"Branden Horiuchi","email":"bhoriuchi@gmail.com"},"bugs":{"url":"https://github.com/bhoriuchi/passport-activedirectory/issues"},"license":"MIT","readme":"# passport-activedirectory\n\nActive Directory strategy for [`passport.js`](https://github.com/jaredhanson/passport)\n\n---\n\nThis Strategy is a *\"fork\"* of [`passport-windowsauth`](https://github.com/auth0/passport-windowsauth) that uses the [`activedirectory`](https://github.com/gheeres/node-activedirectory) module instead of directly calling [`ldapjs`](https://github.com/mcavage/node-ldapjs).\n\nThe module works almost identically except that the `verify` function is passed the `ActiveDirectory` object as a parameter so that you can use the query functions included in [`activedirectory`](https://github.com/gheeres/node-activedirectory) during verification. This is useful when using nested AD groups where you want to identify if a user is a member of a root level group.\n\n### Example\n\n#### Setup\n```js\nvar passport = require('passport')\nvar ActiveDirectoryStrategy = require('passport-activedirectory')\n\npassport.use(new ActiveDirectoryStrategy({\n  integrated: false,\n  ldap: {\n    url: 'ldap://my.domain.com',\n    baseDN: 'DC=my,DC=domain,DC=com',\n    username: 'readuser@my.domain.com',\n    password: 'readuserspassword'\n  }\n}, function (profile, ad, done) {\n  ad.isUserMemberOf(profile._json.dn, 'AccessGroup', function (err, isMember) {\n    if (err) return done(err)\n    return done(null, profile)\n  })\n}))\n```\n#### Protecting a path\n\n```js\nvar opts = { failWithError: true }\napp.post('/login', passport.authenticate('ActiveDirectory', opts), function(req, res) {\n  res.json(req.user)\n}, function (err) {\n  res.status(401).send('Not Authenticated')\n})\n\n// example request\n// > curl -H \"Content-Type: application/json\" -X POST -d '{\"username\":\"xyz\",\"password\":\"xyz\"}' http://localhost/login\n```\n\n#### Optionally reuse an existing instance of `activedirectory`\n\n```js\nvar passport = require('passport')\nvar ActiveDirectoryStrategy = require('passport-activedirectory')\nvar ActiveDirectory = require('activedirectory')\n\nvar ad = new ActiveDirectory({\n  url: 'ldap://my.domain.com',\n  baseDN: 'DC=my,DC=domain,DC=com',\n  username: 'readuser@my.domain.com',\n  password: 'readuserspassword'\n})\n\npassport.use(new ActiveDirectoryStrategy({\n  integrated: false,\n  ldap: ad\n}, function (profile, ad, done) {\n  ad.isUserMemberOf(profile._json.dn, 'AccessGroup', function (err, isMember) {\n    if (err) return done(err)\n    return done(null, profile)\n  })\n}))\n```\n\n### API\n\n#### ActiveDirectoryStrategy ( `options`, `verify` )\n\n* `options` { `Object` } - Options for connecting and verification\n  * [`integrated=true`] { `Boolean` } - Use windows integrated login. For username and password authentication set this to `false`\n  * [`passReqToCallback=false`] { `Boolean` } - Pass the request to the callback\n  * [`usernameField=\"username\"`] { `String` } - request body field to use for the username\n  * [`passwordField=\"password\"`] { `String` } - request body field to use for the password\n  * [`mapProfile`] { `Function` } - Custom profile mapping function. Takes user object as only parameter and returns a profile object. `_json` is added to the object with the full object\n  * [`ldap`] { `Object` | `ActiveDirectory` } - LDAP connection object. Extended properties are documented [here](https://github.com/gheeres/node-activedirectory#optional-parameters--extended-functionality). You may also supply an instance of `activedirectory` instead.\n    * `url` { `String` } - LDAP URL (e.g. `ldap://my.domain.com`)\n    * `baseDN` { `String` } - Base LDAP DN to search for users in\n    * `username` { `String` } - User name of account with access to search the directory\n    * `password` { `String` } - Password for username\n    * [`filter`] { `Function` } - Takes `username` as its only parameter and returns an ldap query for that user\n    * [`attributes`] { `Array` } - Array of attributes to include in the profile under the `profile._json` key. The `dn` property is always added because it is used to authenticate the user\n* `verify` { `Function` } - Verification function. Depending on the options supplied the signature will be one of the following\n  * Signatures\n    * `verify ( profile, ad, done )` - Using ldap\n    * `verify( req, profile, ad, done )` - Using ldap and with the `passReqToCallback` option set to `true`\n    * `verify ( profile, done )` - Not using ldap\n    * `verify ( req, profile, done )` - Not using ldap and with the `passReqToCallback` option set to `true`\n  * Params\n    * `profile` { `Object` } - User profile object\n    * `req` { `Object` } - request object\n    * `ad` { `Object` } - `ActiveDirectory` instance\n    * `done` { `Function` } - Passport callback\n\n\n### More Information\n\n* For information on setting up integrated authentication with IIS and Apache, review the documentation at [`passport-windowsauth`](https://github.com/auth0/passport-windowsauth#integrated-authentication-iis)\n* For more information on ActiveDirectory methods review [`activedirectory`](https://github.com/gheeres/node-activedirectory)","readmeFilename":"README.md"}