externalldap: add eventlog

This commit is contained in:
Girish Ramakrishnan
2024-01-13 13:02:43 +01:00
parent 4f9e43859c
commit 4136272382
7 changed files with 42 additions and 24 deletions
+22 -22
View File
@@ -183,7 +183,7 @@ function stopLdapServer(callback) {
}
describe('External LDAP', function () {
const { setup, cleanup, admin, serverUrl } = common;
const { setup, cleanup, admin, serverUrl, auditSource } = common;
before(function (done) {
async.series([
@@ -204,7 +204,7 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
delete conf.url;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -212,7 +212,7 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.url = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -220,7 +220,7 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
delete conf.baseDn;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -228,7 +228,7 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.baseDn = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -236,7 +236,7 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
delete conf.filter;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -244,16 +244,16 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.filter = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('enabling succeeds', async function () {
await externalLdap.setConfig(LDAP_CONFIG);
await externalLdap.setConfig(LDAP_CONFIG, auditSource);
});
it('disabling succeeds', async function () {
await externalLdap.setConfig({ provider: 'noop' });
await externalLdap.setConfig({ provider: 'noop' }, auditSource);
});
// now test with groups
@@ -262,7 +262,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
delete conf.groupBaseDn;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -271,7 +271,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
conf.groupBaseDn = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -280,7 +280,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
delete conf.groupFilter;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -289,7 +289,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
conf.groupFilter = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -298,7 +298,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
delete conf.groupnameField;
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -307,7 +307,7 @@ describe('External LDAP', function () {
conf.syncGroups = true;
conf.groupnameField = '';
const [error] = await safe(externalLdap.setConfig(conf));
const [error] = await safe(externalLdap.setConfig(conf, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
@@ -315,13 +315,13 @@ describe('External LDAP', function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.syncGroups = true;
await externalLdap.setConfig(conf);
await externalLdap.setConfig(conf, auditSource);
});
});
describe('verifyPassword', function () {
before(async function () {
await externalLdap.setConfig(LDAP_CONFIG);
await externalLdap.setConfig(LDAP_CONFIG, auditSource);
gLdapUsers = [{
username: 'maximus',
@@ -375,7 +375,7 @@ describe('External LDAP', function () {
});
it('disable sync', async function () {
await externalLdap.setConfig({ provider: 'noop' });
await externalLdap.setConfig({ provider: 'noop' }, auditSource);
});
it('fails if disabled', async function () {
@@ -384,7 +384,7 @@ describe('External LDAP', function () {
});
it('enable', async function () {
await externalLdap.setConfig(LDAP_CONFIG);
await externalLdap.setConfig(LDAP_CONFIG, auditSource);
});
it('succeeds for new users', async function () {
@@ -439,7 +439,7 @@ describe('External LDAP', function () {
it('enable with groupSync', async function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.syncGroups = true;
await externalLdap.setConfig(conf);
await externalLdap.setConfig(conf, auditSource);
});
it('succeeds with groups enabled', async function () {
@@ -537,7 +537,7 @@ describe('External LDAP', function () {
after(server.stop);
it('enable', async function () {
await externalLdap.setConfig(LDAP_CONFIG);
await externalLdap.setConfig(LDAP_CONFIG, auditSource);
});
it('fails if auto create is disabled', async function () {
@@ -562,7 +562,7 @@ describe('External LDAP', function () {
it('enable auto create', async function () {
let conf = Object.assign({}, LDAP_CONFIG);
conf.autoCreate = true;
await externalLdap.setConfig(conf);
await externalLdap.setConfig(conf, auditSource);
});
it('fails for unknown user', async function () {