Try to fix Node 12 Buffer() deprecation errors.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2020-01-18 16:01:02 +02:00
parent 7efbf30af6
commit 9b905c2833
8 changed files with 147 additions and 217 deletions

View file

@ -286,14 +286,14 @@ export default class LDAP {
if (attribute) {
filter = new this.ldapjs.filters.EqualityFilter({
attribute,
value: new Buffer.alloc(id, 'hex'),
value: Buffer.from(id, 'hex'),
});
} else {
const filters = [];
Unique_Identifier_Field.forEach((item) => {
filters.push(new this.ldapjs.filters.EqualityFilter({
attribute: item,
value : new Buffer.alloc(id, 'hex'),
value : Buffer.from(id, 'hex'),
}));
});

View file

@ -131,9 +131,9 @@ var getTokenContent = function (token) {
if (token) {
try {
var parts = token.split('.');
var header = JSON.parse(new Buffer.alloc(parts[0], 'base64').toString());
content = JSON.parse(new Buffer.alloc(parts[1], 'base64').toString());
var signature = new Buffer.alloc(parts[2], 'base64');
var header = JSON.parse(Buffer.from(parts[0], 'base64').toString());
content = JSON.parse(Buffer.from(parts[1], 'base64').toString());
var signature = Buffer.from(parts[2], 'base64');
var signed = parts[0] + '.' + parts[1];
} catch (err) {
this.content = {