File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,15 @@ export const getCookieOptions = (req: express.Request): express.CookieOptions =>
318
318
// When logging in or out the request must include the href (the full current
319
319
// URL of that page) and the relative path to the root as given to it by the
320
320
// backend. Using these two we can determine the true absolute root.
321
+
322
+
323
+ function getConfigCookieMaxAgeAsMilliseconds ( req : express . Request ) : number {
324
+ // the CLI flag or YAML key should be defined as "auth.cookie-max-age"
325
+ const days = Number ( req . args [ "auth.cookie-max-age" ] || 0 )
326
+ return days * 24 * 60 * 60 * 1000
327
+ }
328
+
329
+
321
330
const url = new URL (
322
331
req . query . base || req . body ?. base || "/" ,
323
332
req . query . href || req . body ?. href || "http://" + ( req . headers . host || "localhost" ) ,
@@ -326,6 +335,7 @@ export const getCookieOptions = (req: express.Request): express.CookieOptions =>
326
335
domain : getCookieDomain ( url . host , req . args [ "proxy-domain" ] ) ,
327
336
path : normalize ( url . pathname ) || "/" ,
328
337
sameSite : "lax" ,
338
+ maxAge : getConfigCookieMaxAgeAsMilliseconds ( req ) || 0 ,
329
339
}
330
340
}
331
341
You can’t perform that action at this time.
0 commit comments