chore: bring everything up2date

master
simon 3 years ago
parent 4711c385c8
commit 1778948ee2

6975
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -34,27 +34,27 @@
"debug": "^4.3.1",
"imap-simple": "^5.0.0",
"ldapauth-fork": "^5.0.1",
"ldapjs": "^2.2.2",
"ldapjs": "^2.2.3",
"native-duplexpair": "^1.0.0",
"node-cache": "^5.1.2",
"radius": "~1.1.4",
"smtp-client": "^0.3.3",
"yargs": "~16.1.1"
"yargs": "~16.2.0"
},
"license": "GPLv3",
"devDependencies": {
"@hokify/eslint-config": "^1.0.5",
"@hokify/eslint-config": "^1.1.0",
"@types/chai": "^4.2.14",
"@types/ldapjs": "^1.0.9",
"@types/mocha": "^8.0.4",
"@types/mocha": "^8.2.0",
"@types/radius": "0.0.28",
"@types/yargs": "^15.0.10",
"@types/yargs": "^15.0.12",
"chai": "^4.2.0",
"eslint": "^7.14.0",
"eslint": "^7.18.0",
"mocha": "^8.2.1",
"prettier": "^2.2.1",
"standard-version": "^9.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.1.2"
"standard-version": "^9.1.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
}
}

@ -79,7 +79,7 @@ export class GoogleLDAPAuth implements IAuthentication {
return;
}
res.on('searchEntry', function (entry) {
res.on('searchEntry', (entry) => {
// log('entry: ' + JSON.stringify(entry.object));
usernameFields.forEach((field) => {
const index = entry.object[field] as string;
@ -87,11 +87,11 @@ export class GoogleLDAPAuth implements IAuthentication {
});
});
res.on('searchReference', function (referral) {
res.on('searchReference', (referral) => {
log(`referral: ${referral.uris.join()}`);
});
res.on('error', function (ldapErr) {
res.on('error', (ldapErr) => {
console.error(`error: ${JSON.stringify(ldapErr)}`);
reject(ldapErr);
});
@ -110,7 +110,12 @@ export class GoogleLDAPAuth implements IAuthentication {
this.lastDNsFetch = new Date();
}
async authenticate(username: string, password: string, count = 0, forceFetching = false) {
async authenticate(
username: string,
password: string,
count = 0,
forceFetching = false
): Promise<boolean> {
const cacheValidTime = new Date();
cacheValidTime.setHours(cacheValidTime.getHours() - 12);
@ -150,7 +155,7 @@ export class GoogleLDAPAuth implements IAuthentication {
authClient.bind(dn, password, (err, res) => {
if (err) {
if (err && (err as any).stack && (err as any).stack.includes(`ldap.google.com closed`)) {
count++;
count += 1;
// wait 1 second to give the ldap error handler time to reconnect
setTimeout(() => resolve(this.authenticate(dn, password)), 2000);
return;
@ -167,6 +172,6 @@ export class GoogleLDAPAuth implements IAuthentication {
});
});
return !!authResult;
return authResult;
}
}

@ -43,14 +43,14 @@ export class LDAPAuth implements IAuthentication {
searchFilter: config.searchFilter || '(uid={{username}})',
reconnect: true,
});
this.ldap.on('error', function (err) {
this.ldap.on('error', (err) => {
console.error('LdapAuth: ', err);
});
}
async authenticate(username: string, password: string) {
async authenticate(username: string, password: string): Promise<boolean> {
const authResult: boolean = await new Promise((resolve, reject) => {
this.ldap.authenticate(username, password, function (err, user) {
this.ldap.authenticate(username, password, (err, user) => {
if (err) {
resolve(false);
console.error('ldap error', err);
@ -61,6 +61,6 @@ export class LDAPAuth implements IAuthentication {
});
});
return !!authResult;
return authResult;
}
}

@ -86,9 +86,9 @@ export class EAPPacketHandler implements IPacketHandler {
supportedEAPMethods.push(supportedMethod);
}
currentState.validMethods = currentState.validMethods.filter((method) => {
return supportedEAPMethods.includes(method.getEAPType()); // kick it out?
});
currentState.validMethods = currentState.validMethods.filter(
(method) => supportedEAPMethods.includes(method.getEAPType()) // kick it out?
);
// save
this.eapConnectionStates.set(stateID, currentState);
@ -101,9 +101,7 @@ export class EAPPacketHandler implements IPacketHandler {
// continue with responding a NAK and add rest of supported methods
// eslint-disable-next-line no-fallthrough
default: {
const eapMethod = this.eapMethods.find((method) => {
return type === method.getEAPType();
});
const eapMethod = this.eapMethods.find((method) => type === method.getEAPType());
if (eapMethod) {
return eapMethod.handleMessage(

Loading…
Cancel
Save