aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/auth.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-11 08:40:38 +0200
committerChocobozzz <me@florianbigard.com>2020-05-11 08:40:38 +0200
commit81c647ff191677e3b77814545d12e590c7ebfb1d (patch)
tree6755c2d7f9b1e530ba778f29bb70ab86014145a7 /server/lib/auth.ts
parent3cf198e4f4ea0de47a54268ff50c120e64e721e5 (diff)
downloadPeerTube-81c647ff191677e3b77814545d12e590c7ebfb1d.tar.gz
PeerTube-81c647ff191677e3b77814545d12e590c7ebfb1d.tar.zst
PeerTube-81c647ff191677e3b77814545d12e590c7ebfb1d.zip
Cleanup oauth tokens cache
Diffstat (limited to 'server/lib/auth.ts')
-rw-r--r--server/lib/auth.ts8
1 files changed, 8 insertions, 0 deletions
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: {
105 authName 105 authName
106 }) 106 })
107 107
108 // Cleanup
109 const now = new Date()
110 for (const [ key, value ] of authBypassTokens) {
111 if (value.expires.getTime() < now.getTime()) {
112 authBypassTokens.delete(key)
113 }
114 }
115
108 res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`) 116 res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`)
109} 117}
110 118