From 838ea566053a9cea2bde0d5a09fdab24fa79a1ee Mon Sep 17 00:00:00 2001 From: bo0tzz Date: Wed, 8 Mar 2023 17:26:49 +0100 Subject: [PATCH] fix(server): Increase authentication cookie max-age (#1971) This got missed in #1381. --- server/libs/domain/src/auth/auth.core.ts | 2 +- server/libs/domain/test/fixtures.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/libs/domain/src/auth/auth.core.ts b/server/libs/domain/src/auth/auth.core.ts index d330baad74..c1618cb39e 100644 --- a/server/libs/domain/src/auth/auth.core.ts +++ b/server/libs/domain/src/auth/auth.core.ts @@ -24,7 +24,7 @@ export class AuthCore { } public getCookies(loginResponse: LoginResponseDto, authType: AuthType, isSecure: boolean) { - const maxAge = 7 * 24 * 3600; // 7 days + const maxAge = 400 * 24 * 3600; // 400 days let authTypeCookie = ''; let accessTokenCookie = ''; diff --git a/server/libs/domain/test/fixtures.ts b/server/libs/domain/test/fixtures.ts index 78f0ee03f1..27efcd2174 100644 --- a/server/libs/domain/test/fixtures.ts +++ b/server/libs/domain/test/fixtures.ts @@ -338,8 +338,8 @@ export const loginResponseStub = { shouldChangePassword: false, }, cookie: [ - 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=604800; SameSite=Lax;', - 'immich_auth_type=oauth; HttpOnly; Secure; Path=/; Max-Age=604800; SameSite=Lax;', + 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;', + 'immich_auth_type=oauth; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;', ], }, user1password: { @@ -354,8 +354,8 @@ export const loginResponseStub = { shouldChangePassword: false, }, cookie: [ - 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=604800; SameSite=Lax;', - 'immich_auth_type=password; HttpOnly; Secure; Path=/; Max-Age=604800; SameSite=Lax;', + 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;', + 'immich_auth_type=password; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;', ], }, user1insecure: { @@ -370,8 +370,8 @@ export const loginResponseStub = { shouldChangePassword: false, }, cookie: [ - 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Path=/; Max-Age=604800; SameSite=Lax;', - 'immich_auth_type=password; HttpOnly; Path=/; Max-Age=604800; SameSite=Lax;', + 'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Path=/; Max-Age=34560000; SameSite=Lax;', + 'immich_auth_type=password; HttpOnly; Path=/; Max-Age=34560000; SameSite=Lax;', ], }, };