New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ldapauth-fork

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldapauth-fork - npm Package Compare versions

Comparing version 2.5.3 to 2.5.4

4

CHANGES.md
# node-ldapauth-fork Changelog
## 2.5.4
- [pull request #42] Update ldapjs to 1.0.1 (and use ~ in package.json for it)
## 2.5.3

@@ -4,0 +8,0 @@

13

lib/ldapauth.js

@@ -93,10 +93,2 @@ /**

* for available options
* maxConnections {Integer}
* Whether or not to enable connection pooling, and if so, how many to
* maintain.
* checkInterval {Integer}
* How often to schedule health checks for the connection pool.
* maxIdleTime {Integer}
* How long a client can be idle before health-checking the connection
* (subject to the checkInterval frequency)
* includeRaw {boolean}

@@ -132,7 +124,4 @@ * Optional, default false. Set to true to add property '_raw'

tlsOptions: opts.tlsOptions,
maxConnections: opts.maxConnections,
bindDn: getOption(opts, ['bindDn', 'adminDn']),
bindCredentials: getOption(opts, ['bindCredentials', 'Credentials', 'adminPassword']),
checkInterval: opts.checkInterval,
maxIdleTime: opts.maxIdleTime,
reconnect: opts.reconnect

@@ -323,3 +312,3 @@ };

var self = this;
if (typeof password === 'undefined' || password === null || password === '') {

@@ -326,0 +315,0 @@ return callback('no password given');

{
"name": "ldapauth-fork",
"version": "2.5.3",
"version": "2.5.4",
"main": "./lib/ldapauth.js",

@@ -23,5 +23,5 @@ "description": "Authenticate against an LDAP server",

"bcryptjs": "2.3.0",
"ldapjs": "1.0.0",
"ldapjs": "~1.0.1",
"lru-cache": "3.2.0"
}
}

@@ -36,3 +36,3 @@ Fork of [node-ldapauth](https://github.com/trentm/node-ldapauth) - A simple node.js lib to authenticate against an LDAP server.

[Use the source Luke](https://github.com/vesse/node-ldapauth-fork/blob/master/lib/ldapauth.js#L35-L106)
[Use the source Luke](https://github.com/vesse/node-ldapauth-fork/blob/master/lib/ldapauth.js#L35-L99)

@@ -43,34 +43,34 @@

```javascript
var connect = require('connect');
var basicAuth = require('basic-auth');
var LdapAuth = require('ldapauth-fork');
// Config from a .json or .ini file or whatever.
var config = {
ldap: {
url: "ldaps://ldap.example.com:636",
bindDn: "uid=myadminusername,ou=users,o=example.com",
bindCredentials: "mypassword",
searchBase: "ou=users,o=example.com",
searchFilter: "(uid={{username}})"
}
};
var ldap = new LdapAuth({
url: config.ldap.url,
bindDn: config.ldap.bindDn,
bindCredentials: config.ldap.bindCredentials,
searchBase: config.ldap.searchBase,
searchFilter: config.ldap.searchFilter,
//log4js: require('log4js'),
cache: true
url: "ldaps://ldap.example.com:636",
bindDn: "uid=myadminusername,ou=users,o=example.com",
bindCredentials: "mypassword",
searchBase: "ou=users,o=example.com",
searchFilter: "(uid={{username}})"
});
var basicAuthMiddleware = connect.basicAuth(function (username, password, callback) {
ldap.authenticate(username, password, function (err, user) {
var rejectBasicAuth = function(res) {
res.statusCode = 401;
res.setHeader('WWW-Authenticate', 'Basic realm="Example"');
res.end('Access denied');
}
var basicAuthMiddleware = function(req, res, next) {
var credentials = basicAuth(req);
if (!credentials) {
return rejectBasicAuth(res);
}
ldap.authenticate(credentials.name, credentials.pass, function(err, user) {
if (err) {
console.log("LDAP auth error: %s", err);
return rejectBasicAuth(res);
}
callback(err, user)
req.user = user;
next();
});
});
};
```

@@ -22,4 +22,3 @@ var LdapAuth = require('./lib/ldapauth');

"searchBase": "dc=example,dc=com",
"searchFilter": "(uid={{username}})",
"cache": true
"searchFilter": "(uid={{username}})"
}

@@ -31,13 +30,14 @@

if (err) {
console.warn(err);
console.warn(err, user);
} else {
console.dir(user, {depth: null});
}
a.authenticate('riemann', 'password', function(err, user) {
console.log('second');
a.close(function(err, res) {
console.log(err);
console.log(res);
});
});
a.close();
// a.authenticate('riemann', 'password', function(err, user) {
// console.log('second');
// a.close(function(err, res) {
// console.log(err);
// console.dir(res, {depth: null});
// });
// });
});
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