ProdLaunch

This commit is contained in:
2026-06-18 15:14:10 +02:00
parent d8f58640e5
commit 4c90a7c1a3
12 changed files with 1412 additions and 5 deletions
+5
View File
@@ -80,13 +80,18 @@ def create_refresh_token(subject: str | UUID, tenant_id: str | UUID) -> str:
"""
Crea un JWT refresh token con scadenza lunga (30 giorni default).
Non contiene il ruolo viene rivalutato a ogni refresh.
Include un jti (JWT ID) UUID per garantire unicita' anche se due token
vengono creati nello stesso secondo per lo stesso utente.
"""
import uuid as _uuid
now = datetime.now(UTC)
expire = now + timedelta(days=settings.refresh_token_expire_days)
payload: dict[str, Any] = {
"sub": str(subject),
"tid": str(tenant_id),
"jti": str(_uuid.uuid4()), # JWT ID unico per evitare hash duplicati in DB
"iat": now,
"exp": expire,
"type": "refresh",