From df9cb51a89680031b47c483e20269ce940956ac1 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Thu, 17 May 2018 00:40:18 +0200 Subject: [PATCH] Make sure session.domain is provided in config.yml --- server/src/lib/configuration/Configuration.d.ts | 2 +- server/test/configuration/Validator.test.ts | 16 +++++++++++----- server/test/mocks/ServerVariablesMockBuilder.ts | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/src/lib/configuration/Configuration.d.ts b/server/src/lib/configuration/Configuration.d.ts index 995c4705..20555b99 100644 --- a/server/src/lib/configuration/Configuration.d.ts +++ b/server/src/lib/configuration/Configuration.d.ts @@ -63,7 +63,7 @@ interface SessionCookieConfiguration { secret: string; expiration?: number; inactivity?: number; - domain?: string; + domain: string; redis?: SessionRedisOptions; } diff --git a/server/test/configuration/Validator.test.ts b/server/test/configuration/Validator.test.ts index f08a0d2e..e3cd48da 100644 --- a/server/test/configuration/Validator.test.ts +++ b/server/test/configuration/Validator.test.ts @@ -26,6 +26,7 @@ describe("test validator", function () { "data.regulation should have required property 'ban_time'", "data.regulation should have required property 'find_time'", "data.regulation should have required property 'max_retries'", + "data.session should have required property 'domain'", "data.session should have required property 'secret'", "Storage must be either 'local' or 'mongo'", "A notifier needs to be declared when server is used with two-factor" @@ -47,7 +48,8 @@ describe("test validator", function () { max_retries: 3 }, session: { - secret: "unsecure_secret" + secret: "unsecure_secret", + domain: "mydomain" }, storage: { abc: {} @@ -80,7 +82,8 @@ describe("test validator", function () { max_retries: 3 }, session: { - secret: "unsecure_secret" + secret: "unsecure_secret", + domain: "mydomain" }, storage: { local: { @@ -109,7 +112,8 @@ one second factor enabled sub-domain", function () { max_retries: 3 }, session: { - secret: "unsecure_secret" + secret: "unsecure_secret", + domain: "mydomain" }, storage: { local: { @@ -141,7 +145,8 @@ one second factor enabled sub-domain", function () { max_retries: 3 }, session: { - secret: "unsecure_secret" + secret: "unsecure_secret", + domain: "mydomain" }, storage: { local: { @@ -166,7 +171,8 @@ one second factor enabled sub-domain", function () { max_retries: 3 }, session: { - secret: "unsecure_secret" + secret: "unsecure_secret", + domain: "mydomain" }, storage: { local: { diff --git a/server/test/mocks/ServerVariablesMockBuilder.ts b/server/test/mocks/ServerVariablesMockBuilder.ts index 794c310a..7a4ef5ca 100644 --- a/server/test/mocks/ServerVariablesMockBuilder.ts +++ b/server/test/mocks/ServerVariablesMockBuilder.ts @@ -58,7 +58,8 @@ export class ServerVariablesMockBuilder { max_retries: 3 }, session: { - secret: "my_secret" + secret: "my_secret", + domain: "mydomain" }, storage: {} },