feat(auth): renew sessions with 30-day idle and 90-day absolute limits
This commit is contained in:
@@ -116,3 +116,24 @@ and implements label zoom behavior. Core preserves the supplied membership and
|
||||
label mode without inferring them from positions. Renderer-only `zIndex` is
|
||||
ignored alongside transient state; restore frame layering in the frontend.
|
||||
This extends existing JSONB snapshots and requires no additional migration.
|
||||
|
||||
### Browser session lifetime
|
||||
|
||||
Sessions use random, revocable bearer tokens rather than JWTs. New email and OAuth
|
||||
logins have a 30-day idle lifetime; authenticated requests atomically renew that
|
||||
idle deadline, capped at 90 days from issuance. Idle-expired, absolute-expired,
|
||||
revoked and wrong-project tokens are never revived. Logout removes the session.
|
||||
|
||||
Apply `db/004-session-lifetime.sql` before running this version. Existing sessions
|
||||
keep their prior idle expiry, so expired logins remain expired. For legacy rows,
|
||||
the absolute 90-day cap starts at migration time because issuance was not recorded;
|
||||
an unexpired legacy session gains the new idle lifetime on its next authenticated
|
||||
request. New rows record their actual creation time and absolute deadline.
|
||||
|
||||
Login and exchange responses return `expires_in: 2592000`. Protected platform
|
||||
responses and `/auth/me` include `X-Foundry-Session-Expires-In` with the remaining
|
||||
seconds after renewal, shortened near the absolute deadline. The frontend proxy
|
||||
must renew its HttpOnly cookie using that value, with a maximum of 30 days. It must
|
||||
not extend a cookie beyond the backend-provided remaining lifetime, or expose the
|
||||
session token to client JavaScript. CORS exposes the lifetime header alongside
|
||||
ETag where applicable. The absolute deadline stays server-authoritative.
|
||||
|
||||
Reference in New Issue
Block a user