feat(auth): sliding session renewal past half the token lifetime (#1927)

This commit is contained in:
jubnl
2026-08-15 22:48:16 +02:00
parent 61e03fdfde
commit 72221a2e45
8 changed files with 333 additions and 10 deletions
+4
View File
@@ -64,6 +64,7 @@ import { trekMcpAccessPolicy, trekMcpValidateAccess } from '../mcp/nest-mcp-poli
import { TrekExceptionFilter } from './common/trek-exception.filter';
import { SpaFallbackFilter } from './platform/spa-fallback.filter';
import { IdempotencyInterceptor } from './common/idempotency.interceptor';
import { SessionRenewalInterceptor } from './auth/session-renewal.interceptor';
import { IdempotencyCleanupJob } from './common/idempotency-cleanup.job';
import { RealtimeGatewayModule } from './realtime/realtime-gateway.module';
@@ -97,6 +98,9 @@ import { RealtimeGatewayModule } from './realtime/realtime-gateway.module';
// Replays the X-Idempotency-Key the client sends on every write, so retried
// mutations don't double-apply.
{ provide: APP_INTERCEPTOR, useClass: IdempotencyInterceptor },
// Sliding session renewal: re-issues the trek_session cookie once a
// cookie-authenticated token is past half its lifetime (#1927).
{ provide: APP_INTERCEPTOR, useClass: SessionRenewalInterceptor },
// Its nightly TTL purge — a provider here because common/ has no module.
IdempotencyCleanupJob,
// Global Zod validation: any parameter typed with a createZodDto class