passport-activedirectory
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "passport-activedirectory", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Active Directory strategy for passport.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -13,2 +13,3 @@ # passport-activedirectory | ||
#### Setup | ||
```js | ||
@@ -19,2 +20,3 @@ var passport = require('passport') | ||
passport.use(new ActiveDirectoryStrategy({ | ||
integrated: false, | ||
ldap: { | ||
@@ -33,3 +35,16 @@ url: 'ldap://my.domain.com', | ||
``` | ||
#### Protecting a path | ||
```js | ||
var opts = { failWithError: true } | ||
app.post('/login', passport.authenticate('ActiveDirectory', opts), function(req, res) { | ||
res.json(req.user) | ||
}, function (err) { | ||
res.status(401).send('Not Authenticated') | ||
}) | ||
// example request | ||
// > curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost/login | ||
``` | ||
### API | ||
@@ -40,3 +55,3 @@ | ||
* `options` { `Object` } - Options for connecting and verification | ||
* [`integrated=false`] { `Boolean` } - Use windows integrated login | ||
* [`integrated=true`] { `Boolean` } - Use windows integrated login. For username and password authentication set this to `false` | ||
* [`passReqToCallback=false`] { `Boolean` } - Pass the request to the callback | ||
@@ -64,1 +79,7 @@ * [`usernameField="username"`] { `String` } - request body field to use for the username | ||
* `done` { `Function` } - Passport callback | ||
### More Information | ||
* 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) | ||
* For more information on ActiveDirectory methods review [`activedirectory`](https://github.com/gheeres/node-activedirectory) |
10385
80