From 81c647ff191677e3b77814545d12e590c7ebfb1d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 May 2020 08:40:38 +0200 Subject: Cleanup oauth tokens cache --- server/lib/auth.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/lib/auth.ts b/server/lib/auth.ts index 7c1dd1139..8579bdbb4 100644 --- a/server/lib/auth.ts +++ b/server/lib/auth.ts @@ -105,6 +105,14 @@ async function onExternalUserAuthenticated (options: { authName }) + // Cleanup + const now = new Date() + for (const [ key, value ] of authBypassTokens) { + if (value.expires.getTime() < now.getTime()) { + authBypassTokens.delete(key) + } + } + res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`) } -- cgit v1.2.3