passport-ldapauth
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": { | ||
@@ -33,11 +33,15 @@ "type": "MIT", | ||
"dependencies": { | ||
"ldapauth-fork": "~2.2.5", | ||
"ldapauth-fork": "~2.2.13" | ||
}, | ||
"peerDependencies": { | ||
"passport": "~0.2.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.17.x", | ||
"body-parser": "1.3.x", | ||
"chai": "1.9.x", | ||
"express": "4.4.x", | ||
"ldapjs": "0.7.x", | ||
"express": "3.4.x", | ||
"supertest": "0.9.x" | ||
"mocha": "1.20.x", | ||
"supertest": "0.13.x", | ||
"passport": "~0.2.0" | ||
}, | ||
@@ -44,0 +48,0 @@ "scripts": { |
50
test.js
@@ -5,7 +5,11 @@ var express = require('express'), | ||
var log4js = require('log4js'); | ||
var logger = log4js.getLogger(); | ||
var OPTS = { | ||
server: { | ||
url: 'ldap://localhost:12345', | ||
url: 'ldap://localhost:1389', | ||
searchBase: 'ou=passport-ldapauth', | ||
searchFilter: '(uid={{username}})' | ||
searchFilter: '(uid={{username}})', | ||
log4js: log4js | ||
} | ||
@@ -16,15 +20,45 @@ }; | ||
passport.use(new LdapStrategy(OPTS)); | ||
passport.serializeUser(function(user, done) { | ||
console.log('user : ' + user); | ||
console.log('done : ' + done); | ||
console.log('serializeUser was called'); | ||
done(null, 1); | ||
}); | ||
app.configure(function() { | ||
app.use(express.bodyParser()); | ||
app.use(passport.initialize()); | ||
passport.deserializeUser(function(obj, done) { | ||
console.log('deserializeUser was called'); | ||
done(null, obj); | ||
}); | ||
passport.use(new LdapStrategy(OPTS, function(user, done) { | ||
done(null, user); | ||
})); | ||
app.use(require('cookie-parser')()); | ||
app.use(require('body-parser').json()); | ||
app.use(require('express-session')({ | ||
secret: 'secret', | ||
store: new require('express-session').MemoryStore() | ||
})) | ||
app.use(passport.initialize()); | ||
app.use(passport.session()); | ||
app.all('*', function(req, res, next) { | ||
console.log('Request'); | ||
console.log('Request', req.headers, req.body); | ||
next(); | ||
}); | ||
app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res) { | ||
app.get('/login', function(req, res) { | ||
console.log('GET'); | ||
if (req.user) { | ||
console.log('OK'); | ||
res.send(200, {status: 'ok'}); | ||
} else { | ||
console.log('NOK'); | ||
res.send(403); | ||
} | ||
}); | ||
app.post('/login', passport.authenticate('ldapauth'), function(req, res) { | ||
console.log('POST'); | ||
res.send({status: 'ok'}); | ||
@@ -31,0 +65,0 @@ }); |
var express = require('express'), | ||
passport = require('passport'), | ||
LdapStrategy = require('passport-ldapauth').Strategy; | ||
LdapStrategy = require('passport-ldapauth').Strategy, | ||
bodyParser = require('body-parser'); | ||
@@ -23,6 +24,4 @@ var server = null; | ||
app.configure(function() { | ||
app.use(express.bodyParser()); | ||
app.use(passport.initialize()); | ||
}); | ||
app.use(bodyParser()); | ||
app.use(passport.initialize()); | ||
@@ -29,0 +28,0 @@ app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
467
23158
7
12
1
- Removedpassport@~0.2.0
Updatedldapauth-fork@~2.2.13