Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-passport-ldap-mongoose

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-passport-ldap-mongoose - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

spec/helpers/console-reporter.js

10

example/config.js
module.exports = {
dburl : 'mongodb://localhost/ldaptest',
mongodb: {
url: 'mongodb://localhost/ldaptest',
},
sessionSecret: 'ZXaffeqe123!$2',
ldap: {
dn: 'dc=example,dc=com',
url: 'ldap://ldap.forumsys.com'
}
}
url: 'ldap://ldap.forumsys.com',
},
}

34

example/server.js

@@ -7,9 +7,11 @@ /* jshint node:true */

mongoose.Promise = Promise
mongoose.connect(CONFIG.dburl, {
useUnifiedTopology: true,
useNewUrlParser: true,
useFindAndModify: false,
})
const mongoClientPromise = mongoose
.connect(CONFIG.mongodb.url, {
user: CONFIG.mongodb.user,
pass: CONFIG.mongodb.pass,
authSource: 'admin',
})
.then((m) => m.connection.getClient())
const session = require('express-session')
const MongoStore = require('connect-mongo')(session)
const MongoStore = require('connect-mongo')

@@ -25,3 +27,5 @@ const express = require('express')

secret: CONFIG.sessionSecret,
store: new MongoStore({ mongooseConnection: mongoose.connection }),
store: MongoStore.create({
clientPromise: mongoClientPromise,
}),
resave: true,

@@ -83,8 +87,14 @@ saveUninitialized: true,

(id) => User.findOne({ username: id }).exec(),
(user) => {
async (user) => {
console.log(`${user[usernameAttr]} has logged in`)
return User.findOneAndUpdate({ username: user[usernameAttr] }, user, {
upsert: true,
new: true,
}).exec()
let foundUser = await User.findOneAndUpdate(
{ username: user[usernameAttr] },
user,
{
upsert: true,
new: true,
}
).exec()
console.log(`${foundUser.username} is retrieved from database`)
return foundUser
}

@@ -91,0 +101,0 @@ )

@@ -48,3 +48,2 @@ /**

}
_router = router
_findFunc = findFunc

@@ -51,0 +50,0 @@ _insertFunc = insertFunc

{
"name": "express-passport-ldap-mongoose",
"version": "3.1.0",
"description": "A library to use passport-ldapauth and local MongoDB to authenticate and save users",
"version": "3.1.1",
"description": "A library to use ldap-authentication and passport to authenticate users",
"main": "index.js",

@@ -10,19 +10,18 @@ "repository": "https://github.com/shaozi/express-passport-ldap-mongoose.git",

"dependencies": {
"ldap-authentication": "^2.2.7",
"passport": "^0.4.1",
"ldap-authentication": "^2.2.9",
"passport": "^0.5.2",
"passport-custom": "^1.1.1"
},
"devDependencies": {
"connect-mongo": "^3.2.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"jasmine": "^3.7.0",
"jasmine-console-reporter": "^3.1.0",
"mongoose": "^5.9.18",
"superagent": "^5.2.2",
"supertest": "^4.0.2"
"connect-mongo": "^4.6.0",
"express": "^4.18.0",
"express-session": "^1.17.2",
"jasmine": "^4.1.0",
"mongoose": "^6.3.1",
"superagent": "^7.1.2",
"supertest": "^6.2.2"
},
"scripts": {
"test": "node test/jasmine.js"
"test": "jasmine"
}
}

@@ -148,6 +148,9 @@ # express-passport-ldap-mongoose

app,
(id) => {
return User.findOne({ usernameAttributeName: id }).exec()
}, (user) => {
return User.findOneAndUpdate({ username: user[usernameAttributeName] }, user, { upsert: true, new: true }).exec()
async (id) => {
let user = await User.findOne({ usernameAttributeName: id }).exec()
return user
},
async (user) => {
let foundUser = await User.findOneAndUpdate({ username: user[usernameAttributeName] }, user, { upsert: true, new: true }).exec()
return foundUser
})

@@ -154,0 +157,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc