File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 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 =>
318318 // When logging in or out the request must include the href (the full current
319319 // URL of that page) and the relative path to the root as given to it by the
320320 // 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+
321330 const url = new URL (
322331 req . query . base || req . body ?. base || "/" ,
323332 req . query . href || req . body ?. href || "http://" + ( req . headers . host || "localhost" ) ,
@@ -326,6 +335,7 @@ export const getCookieOptions = (req: express.Request): express.CookieOptions =>
326335 domain : getCookieDomain ( url . host , req . args [ "proxy-domain" ] ) ,
327336 path : normalize ( url . pathname ) || "/" ,
328337 sameSite : "lax" ,
338+ maxAge : getConfigCookieMaxAgeAsMilliseconds ( req ) || 0 ,
329339 }
330340}
331341
You can’t perform that action at this time.
0 commit comments