From 983cb2cc57b78d96e5c7b1fb19fc69d89092b402 Mon Sep 17 00:00:00 2001 From: static Date: Tue, 8 Jul 2025 13:49:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=B8=EC=85=98=20=EC=BF=A0=ED=82=A4?= =?UTF-8?q?=EB=A5=BC=20=EA=B3=84=EC=86=8D=20=EB=A1=A4=EB=A7=81=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EA=B0=9C=EC=84=A0=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EC=84=B8=EC=85=98=EC=9D=B4=20=EC=9C=A0=ED=9A=A8=ED=95=A8?= =?UTF-8?q?=EC=97=90=EB=8F=84=20=EB=B8=8C=EB=9D=BC=EC=9A=B0=EC=A0=80?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=BF=A0=ED=82=A4=EA=B0=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EB=90=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/server/middlewares/authenticate.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/server/middlewares/authenticate.ts b/src/lib/server/middlewares/authenticate.ts index 8880f1a..8585bce 100644 --- a/src/lib/server/middlewares/authenticate.ts +++ b/src/lib/server/middlewares/authenticate.ts @@ -1,4 +1,5 @@ import { error, redirect, type Handle } from "@sveltejs/kit"; +import env from "$lib/server/loadenv"; import { authenticate, AuthenticationError } from "$lib/server/modules/auth"; export const authenticateMiddleware: Handle = async ({ event, resolve }) => { @@ -15,6 +16,12 @@ export const authenticateMiddleware: Handle = async ({ event, resolve }) => { const { ip, userAgent } = event.locals; event.locals.session = await authenticate(sessionIdSigned, ip, userAgent); + event.cookies.set("sessionId", sessionIdSigned, { + path: "/", + maxAge: env.session.exp / 1000, + secure: true, + sameSite: "strict", + }); } catch (e) { if (e instanceof AuthenticationError) { if (pathname === "/auth/login") {