passport-ldapauth
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -33,3 +33,3 @@ "use strict"; | ||
* url: 'ldap://localhost:389', | ||
* adminDN: 'cn=root', | ||
* adminDn: 'cn=root', | ||
* adminPassword: 'secret', | ||
@@ -36,0 +36,0 @@ * searchBase: 'ou=passport-ldapauth', |
{ | ||
"name": "passport-ldapauth", | ||
"description": "Passport authentication strategy for LDAP", | ||
"description": "LDAP authentication strategy for Passport", | ||
"author": "Vesa Poikajärvi <vesa.poikajarvi@iki.fi>", | ||
@@ -11,3 +11,3 @@ "keywords": [ | ||
], | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"license": { | ||
@@ -33,7 +33,7 @@ "type": "MIT", | ||
"devDependencies": { | ||
"mocha": "1.9.x", | ||
"chai": "1.5.x", | ||
"mocha": "1.12.x", | ||
"chai": "1.7.x", | ||
"ldapjs": "0.6.x", | ||
"express": "3.1.x", | ||
"supertest": "0.5.x" | ||
"express": "3.3.x", | ||
"supertest": "0.7.x" | ||
}, | ||
@@ -40,0 +40,0 @@ "scripts": { |
@@ -51,4 +51,4 @@ # passport-ldapauth | ||
* `url`: e.g. `ldap://localhost:389` | ||
* `adminDN`: e.g. `cn='root'` | ||
* `adminPassword`: Password for adminDN | ||
* `adminDn`: e.g. `cn='root'` | ||
* `adminPassword`: Password for adminDn | ||
* `searchBase`: e.g. `o=users,o=example.com` | ||
@@ -55,0 +55,0 @@ * `searchFilter`: LDAP search filter, e.g. `(uid={{username}})`. Use literal `{{username}}` to have the given username used in the search. |
@@ -7,8 +7,4 @@ var express = require('express'), | ||
var init_passport = function(opts, no_callback) { | ||
passport.serializeUser(function(user, cb) { | ||
return cb(null, 'dummykey'); | ||
}); | ||
if (no_callback) { | ||
var init_passport = function(opts, testopts) { | ||
if (testopts.no_callback === true) { | ||
passport.use(new LdapStrategy(opts)); | ||
@@ -22,7 +18,7 @@ } else { | ||
exports.start = function(opts, no_callback, cb) { | ||
exports.start = function(opts, testopts, cb) { | ||
var app = express(); | ||
init_passport(opts, no_callback); | ||
init_passport(opts, testopts); | ||
@@ -34,3 +30,3 @@ app.configure(function() { | ||
app.post('/login', passport.authenticate('ldapauth'), function(req, res) { | ||
app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res) { | ||
res.send({status: 'ok'}); | ||
@@ -37,0 +33,0 @@ }); |
@@ -17,2 +17,5 @@ var should = require('chai').Should(), | ||
} | ||
}, | ||
TEST_OPTS = { | ||
no_callback: false | ||
}; | ||
@@ -25,3 +28,3 @@ | ||
ldapserver.start(LDAP_PORT, function() { | ||
appserver.start(OPTS, false, function(app) { | ||
appserver.start(OPTS, TEST_OPTS, function(app) { | ||
expressapp = app; | ||
@@ -103,3 +106,5 @@ cb(); | ||
it("should authenticate without a verify callback", function(cb) { | ||
appserver.start(OPTS, true, function(app) { | ||
TEST_OPTS.no_callback = true; | ||
appserver.start(OPTS, TEST_OPTS, function(app) { | ||
TEST_OPTS.no_callback = false | ||
request(expressapp) | ||
@@ -114,3 +119,5 @@ .post('/login') | ||
it("should reject invalid event without a verify callback", function(cb) { | ||
appserver.start(OPTS, true, function(app) { | ||
TEST_OPTS.no_callback = true; | ||
appserver.start(OPTS, TEST_OPTS, function(app) { | ||
TEST_OPTS.no_callback = false; | ||
request(expressapp) | ||
@@ -127,4 +134,5 @@ .post('/login') | ||
OPTS.passwordField = 'ldappwd'; | ||
appserver.start(OPTS, true, function(app) { | ||
OPTS.no_callback = true; | ||
appserver.start(OPTS, TEST_OPTS, function(app) { | ||
OPTS.no_callback = false; | ||
request(expressapp) | ||
@@ -131,0 +139,0 @@ .post('/login') |
Sorry, the diff of this file is not supported yet
16138
354