Skip to content

Commit a179253

Browse files
committed
wip
1 parent 12000c2 commit a179253

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

spec/AuthenticationAdapters.spec.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ describe('AuthenticationProviders', function () {
377377
const authDataSpy = spyOn(adapter, 'validateAuthData').and.callThrough();
378378
const appIdSpy = spyOn(adapter, 'validateAppId').and.callThrough();
379379

380+
await reconfigureServer({ auth: { customAuthentication: adapter } });
381+
380382
const authenticationHandler = authenticationLoader({
381383
customAuthentication: adapter,
382384
});
@@ -392,6 +394,14 @@ describe('AuthenticationProviders', function () {
392394
});
393395

394396
it('properly loads custom adapter module object', async () => {
397+
await reconfigureServer({
398+
auth: {
399+
customAuthentication: {
400+
validateAppId() {},
401+
validateAuthData() {},
402+
},
403+
},
404+
});
395405
const authenticationHandler = authenticationLoader();
396406

397407
validateAuthenticationHandler(authenticationHandler);
@@ -406,27 +416,27 @@ describe('AuthenticationProviders', function () {
406416
);
407417
});
408418

409-
it('properly loads custom adapter module object (again)', done => {
419+
it('properly loads custom adapter module object (again)', async () => {
420+
await reconfigureServer({
421+
auth: {
422+
customAuthentication: {
423+
validateAppId() {},
424+
validateAuthData() {},
425+
},
426+
},
427+
});
410428
const authenticationHandler = authenticationLoader();
411429

412430
validateAuthenticationHandler(authenticationHandler);
413431
const { validator } = authenticationHandler.getValidatorForProvider('customAuthentication');
414432
validateValidator(validator);
415433

416-
validator(
434+
await validator(
417435
{
418436
token: 'valid-token',
419437
},
420438
{},
421439
{}
422-
).then(
423-
() => {
424-
done();
425-
},
426-
err => {
427-
jfail(err);
428-
done();
429-
}
430440
);
431441
});
432442

src/Adapters/Auth/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const providers = {
6363
ldap,
6464
};
6565

66-
const authAdapters = {};
66+
let authAdapters = {};
6767

6868
// Indexed auth policies
6969
const authAdapterPolicies = {
@@ -202,6 +202,7 @@ function loadAuthAdapter(provider, authOptions, cached) {
202202
}
203203

204204
function validateAuthConfig(auth) {
205+
authAdapters = {};
205206
if (!auth.anonymous) {
206207
auth.anonymous = { enabled: true };
207208
}

0 commit comments

Comments
 (0)