fix(auth): read JSESSIONID cookie to match Spring Security default
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,10 @@ describe('auth guard (hooks.server.ts handle)', () => {
|
|||||||
const event = {
|
const event = {
|
||||||
url: new URL(`http://localhost${pathname}`),
|
url: new URL(`http://localhost${pathname}`),
|
||||||
cookies: {
|
cookies: {
|
||||||
get: vi.fn().mockReturnValue(cookie)
|
get: vi.fn().mockImplementation((name: string) => {
|
||||||
|
if (name === 'JSESSIONID') return cookie;
|
||||||
|
return undefined;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
locals: {} as any,
|
locals: {} as any,
|
||||||
fetch: vi.fn()
|
fetch: vi.fn()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||||||
return resolve(event);
|
return resolve(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionCookie = event.cookies.get('session');
|
const sessionCookie = event.cookies.get('JSESSIONID');
|
||||||
if (!sessionCookie) {
|
if (!sessionCookie) {
|
||||||
loginRedirect(event.url.pathname);
|
loginRedirect(event.url.pathname);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user