1
0

Bump auth cookie expiry

This commit is contained in:
Zef Hemel 2023-12-11 13:53:08 +01:00
parent 3344156d3c
commit 06a50b6987

View File

@ -276,7 +276,9 @@ export class HttpServer {
authCookieName(host), authCookieName(host),
jwt, jwt,
{ {
expires: new Date(Date.now() + authenticationExpirySeconds), // in a week expires: new Date(
Date.now() + authenticationExpirySeconds * 1000,
), // in a week
sameSite: "strict", sameSite: "strict",
}, },
); );
@ -305,6 +307,7 @@ export class HttpServer {
if (!excludedPaths.includes(request.url.pathname)) { if (!excludedPaths.includes(request.url.pathname)) {
const authCookie = await cookies.get(authCookieName(host)); const authCookie = await cookies.get(authCookieName(host));
if (!authCookie) { if (!authCookie) {
console.log("Unauthorized access, redirecting to auth page");
return response.redirect("/.auth"); return response.redirect("/.auth");
} }
const [expectedUser] = spaceServer.auth!.split( const [expectedUser] = spaceServer.auth!.split(