passport-ldapauth
Advanced tools
Comparing version 0.2.6 to 0.3.0
## Changes | ||
* v0.3.0 | ||
* [#10](https://github.com/vesse/passport-ldapauth/issues/10) - Add support for fetching groups. While this is really coming from [ldapauth-fork](https://github.com/vesse/node-ldapauth-fork), updated the minor version of this library as well to draw attention to new features. | ||
* v0.2.5 | ||
@@ -4,0 +6,0 @@ * [#21](https://github.com/vesse/passport-ldapauth/issues/21) - Handle `constraintViolationError` as a login failure instead of an error. |
@@ -17,3 +17,3 @@ { | ||
], | ||
"version": "0.2.6", | ||
"version": "0.3.0", | ||
"license": { | ||
@@ -36,7 +36,7 @@ "type": "MIT", | ||
"passport-strategy": "1.x.x", | ||
"ldapauth-fork": "~2.2.18" | ||
"ldapauth-fork": "~2.3.0" | ||
}, | ||
"devDependencies": { | ||
"body-parser": "1.10.x", | ||
"chai": "1.10.x", | ||
"body-parser": "1.12.x", | ||
"chai": "2.1.x", | ||
"express": "4.9.x", | ||
@@ -43,0 +43,0 @@ "ldapjs": "0.7.x", |
@@ -46,4 +46,17 @@ var ldap = require('ldapjs'); | ||
server.search(SUFFIX, authorize, function(req, res, next) { | ||
if (req.filter.value == 'valid') { | ||
if (req.filter.attribute === 'uid' && req.filter.value === 'valid') { | ||
res.send(db['valid']); | ||
} else if (req.filter.attribute === 'member' && req.filter.value === db.valid.dn) { | ||
res.send({ | ||
dn: 'cn=Group 1, ou=passport-ldapauth', | ||
attributes: { | ||
name: 'Group 1' | ||
} | ||
}); | ||
res.send({ | ||
dn: 'cn=Group 2, ou=passport-ldapauth', | ||
attributes: { | ||
name: 'Group 2' | ||
} | ||
}); | ||
} | ||
@@ -50,0 +63,0 @@ res.end(); |
@@ -231,3 +231,3 @@ var should = require('chai').Should(), | ||
}); | ||
describe("with options as function returning dynamic sets", function() { | ||
@@ -287,2 +287,32 @@ var OPTS = JSON.parse(JSON.stringify(BASE_OPTS)); | ||
}); | ||
describe("with group fetch settings defined", function() { | ||
var OPTS = JSON.parse(JSON.stringify(BASE_OPTS)); | ||
OPTS.server.groupSearchBase = 'ou=passport-ldapauth'; | ||
OPTS.server.groupSearchScope = 'sub'; | ||
OPTS.server.groupSearchFilter = '(member={{dn}})'; | ||
it("should return groups for user", function(cb) { | ||
start_servers(OPTS, BASE_TEST_OPTS)(function() { | ||
var req = {body: {username: 'valid', password: 'valid'}}, | ||
s = new LdapStrategy(OPTS, function(user, done) { | ||
req.should.have.keys('body'); | ||
req.body.should.have.keys(['username', 'password']); | ||
done(null, user); | ||
}); | ||
s.success = function(user) { | ||
should.exist(user); | ||
user.uid.should.equal('valid'); | ||
user._groups.length.should.equal(2); | ||
user._groups[0].name.should.equal('Group 1'); | ||
user._groups[1].name.should.equal('Group 2'); | ||
cb(); | ||
}; | ||
s.authenticate(req); | ||
}); | ||
}); | ||
}); | ||
}); | ||
28114
541
+ Addedbcryptjs@2.1.0(transitive)
+ Addedldapauth-fork@2.3.3(transitive)
- Removedbcrypt@0.7.8(transitive)
- Removedbindings@1.0.0(transitive)
- Removedldapauth-fork@2.2.19(transitive)
Updatedldapauth-fork@~2.3.0