Skip to content

Commit

Permalink
Merge pull request #106 from BalzGuenat/upgrade-ldapjs
Browse files Browse the repository at this point in the history
upgrade ldapjs to 3.0.4
  • Loading branch information
vesse authored Jun 6, 2024
2 parents 8a461ea + 101ffc4 commit 10cc47b
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 89 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ ldapauth-fork can look for valid users groups too. Related options:

Other ldapauth-fork options:

- `includeRaw` - Optional, default false. Set to true to add property `_raw` containing the original buffers to the returned user object. Useful when you need to handle binary attributes
- `cache` - Optional, default false. If true, then up to 100 credentials at a time will be cached for 5 minutes.
- `log` - Bunyan logger instance, optional. If given this will result in TRACE-level error logging for component:ldapauth. The logger is also passed forward to ldapjs.

Expand Down
7 changes: 0 additions & 7 deletions lib/ldapauth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ declare namespace LdapAuth {
*/
groupDnProperty?: string;

/**
* Set to true to add property '_raw' containing the original buffers
* to the returned user object. Useful when you need to handle binary
* attributes
*/
includeRaw?: boolean;

/**
* If true, then up to 100 credentials at a time will be cached for
* 5 minutes.
Expand Down
11 changes: 7 additions & 4 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,13 @@ LdapAuth.prototype._search = function (searchBase, options, callback) {

var items = [];
searchResult.on('searchEntry', function (entry) {
items.push(entry.object);
if (self.opts.includeRaw === true) {
items[items.length - 1]._raw = entry.raw;
}
var pojo = entry.pojo;
var entries = pojo.attributes.map(function (att) {
return [att.type, att.values.length === 1 ? att.values[0] : att.values];
});
var object = Object.fromEntries(entries);
object.dn = pojo.objectName;
items.push(object);
});

searchResult.on('error', callback);
Expand Down
Loading

0 comments on commit 10cc47b

Please sign in to comment.