T13.1: idle timeout + absolute ceiling (D18)

Sessions now slide on activity (AUTH_IDLE_MINUTES, default 30) capped by
a hard ceiling from original sign-in (AUTH_SESSION_HOURS, meaning changed,
default 12 -> proposed 8). login_at carried across reissues so the ceiling
survives refreshes; pre-D18 tokens with no login_at fall back to iat.
Refresh is throttled (~IDLE_MINUTES/3) so the cookie isn't rewritten on
every request. Wired into auth_gate (server/app.py) - no DB hit, reads
only the already-validated claims.

Verified: 7 unit-level checks (fresh-token expiry, past-ceiling refusal,
throttling, mid-session extension, legacy-token fallback both live and
expired, idle cutoff itself) all pass, plus the full 27-check smoke
suite still passes end to end through the new middleware path.
This commit is contained in:
2026-09-23 11:40:59 -07:00
parent 358469531c
commit 6cde6e3f60
4 changed files with 120 additions and 7 deletions

View File

@@ -27,8 +27,18 @@ DATABASE_URL=postgresql+psycopg://wpsuite:CHANGE_ME@localhost:5432/wpsuite
# python -c "import secrets; print(secrets.token_urlsafe(48))"
AUTH_SECRET_KEY=CHANGE_ME_run_the_command_above
# How long a login lasts before re-authentication (hours). Default 12.
# AUTH_SESSION_HOURS=12
# D18 (2026-09-23): a session slides on activity, capped by a hard ceiling
# underneath - not one flat lifetime. Both defaults are proposed, not
# confirmed against this tenant's actual Okta SSO session policy - if Okta's
# own session outlives either number, re-auth here is likely a fast redirect
# rather than a real login screen, so these cost less than they look like.
#
# No request for this many minutes ends the session outright.
# AUTH_IDLE_MINUTES=30
#
# The absolute ceiling from original sign-in, regardless of activity - no
# session outlives this no matter how continuously active it is. Default 8.
# AUTH_SESSION_HOURS=8
# ── Okta OIDC (required — this is the only sign-in path) ───────────────────────
# The Okta *authorization server* issuer, e.g. https://yourorg.okta.com/oauth2/default