From 6885f3da1c1df3e0d90ec4018a270a861d87f0f6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 14 Jul 2020 15:06:46 +0200 Subject: [PATCH] Add configurable maxAge for session cookie, defaults to 30 days --- config/default.ts | 3 ++- src/components/SessionComponent.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/default.ts b/config/default.ts index a41482a..9888df4 100644 --- a/config/default.ts +++ b/config/default.ts @@ -25,7 +25,8 @@ export default { session: { secret: "very_secret_not_known", cookie: { - secure: false + secure: false, + maxAge: 30 * 24 * 3600 * 1000, // 30 days } }, mail: { diff --git a/src/components/SessionComponent.ts b/src/components/SessionComponent.ts index c1993dd..d06e975 100644 --- a/src/components/SessionComponent.ts +++ b/src/components/SessionComponent.ts @@ -22,6 +22,7 @@ export default class SessionComponent extends ApplicationComponent { cookie: { httpOnly: true, secure: config.get('session.cookie.secure'), + maxAge: config.get('session.cookie.maxAge'), }, rolling: true, }));