fix issues

This commit is contained in:
2026-01-01 20:31:05 +01:00
parent 9005a8327c
commit 206a03ec48
267 changed files with 3632 additions and 452 deletions

View File

@@ -6,7 +6,8 @@ import type { Logger } from '@core/shared/application';
import { tryGetHttpRequestContext } from '@adapters/http/RequestContext';
const COOKIE_NAME = 'gp_session';
const SESSION_TTL_MS = 3600 * 1000;
const SESSION_TTL_MS = 3600 * 1000; // 1 hour
const REMEMBER_ME_TTL_MS = 30 * 24 * 60 * 60 * 1000; // 30 days
type StoredSession = AuthSession;
@@ -82,9 +83,10 @@ export class CookieIdentitySessionAdapter implements IdentitySessionPort {
return session;
}
async createSession(user: AuthenticatedUser): Promise<AuthSession> {
async createSession(user: AuthenticatedUser, options?: { rememberMe?: boolean }): Promise<AuthSession> {
const issuedAt = Date.now();
const expiresAt = issuedAt + SESSION_TTL_MS;
const ttlMs = options?.rememberMe ? REMEMBER_ME_TTL_MS : SESSION_TTL_MS;
const expiresAt = issuedAt + ttlMs;
const token = `gp_${randomUUID()}`;
@@ -102,7 +104,7 @@ export class CookieIdentitySessionAdapter implements IdentitySessionPort {
const setCookie = buildSetCookieHeader({
name: COOKIE_NAME,
value: token,
maxAgeSeconds: Math.floor(SESSION_TTL_MS / 1000),
maxAgeSeconds: Math.floor(ttlMs / 1000),
httpOnly: true,
sameSite: 'Lax',
secure: false,