viewof idleTimeout = Inputs.range([5, 60], {
label: "Idle timeout (minutes)",
step: 5,
value: 30
})
viewof maxDuration = Inputs.range([30, 720], {
label: "Max session duration (minutes)",
step: 30,
value: 360
})
viewof activityPattern = Inputs.select(
["Every 10 min for 2 hours", "Every 20 min for 4 hours", "Every 5 min for 1 hour then stop", "Sporadic (15, 45, 90, 200 min)"],
{label: "Activity pattern", value: "Every 20 min for 4 hours"}
)Try It: Session Timeline Simulator
Try It: Session Timeline Simulator
animation
authentication
security
Try Change Idle timeout (minutes) from 30 to 5.
Observe Watch Session State and Reason with idle timeout at 5 minutes.
Explain Explain why activity every 20 minutes exceeds an idle timeout of 5 minutes.
Technical boundaries. The timeline uses the selected activity timestamps, idle timeout, and maximum session duration. Activity extends the session only within those limits.
NoteTry It: Session Timeline Simulator
Explore how idle timeout and maximum session duration interact. Adjust the parameters and add activity timestamps to see when the session expires.
{
function getActivities(pattern) {
if (pattern === "Every 10 min for 2 hours") {
const a = [];
for (let i = 10; i <= 120; i += 10) a.push(i);
return a;
}
if (pattern === "Every 20 min for 4 hours") {
const a = [];
for (let i = 20; i <= 240; i += 20) a.push(i);
return a;
}
if (pattern === "Every 5 min for 1 hour then stop") {
const a = [];
for (let i = 5; i <= 60; i += 5) a.push(i);
return a;
}
return [15, 45, 90, 200];
}
const activities = getActivities(activityPattern);
const maxDur = maxDuration;
const idleTo = idleTimeout;
let lastAct = 0;
let sessionEnd = null;
let endReason = "";
for (let i = 0; i < activities.length; i++) {
const t = activities[i];
if (t > maxDur) {
if (sessionEnd === null) {
sessionEnd = maxDur;
endReason = "Max duration reached";
}
break;
}
if (t - lastAct > idleTo) {
sessionEnd = lastAct + idleTo;
endReason = "Idle timeout (no activity for " + idleTo + " min)";
break;
}
lastAct = t;
}
if (sessionEnd === null) {
const idleExpiry = lastAct + idleTo;
if (idleExpiry < maxDur) {
sessionEnd = idleExpiry;
endReason = "Idle timeout after last activity";
} else {
sessionEnd = maxDur;
endReason = "Max duration reached";
}
}
const barWidth = 600;
const totalTime = Math.max(maxDur, sessionEnd + 30);
const scale = barWidth / totalTime;
const actDots = activities
.filter(a => a <= sessionEnd)
.map(a => {
const x = 40 + a * scale;
return `<circle cx="${x}" cy="40" r="5" fill="#16A085"/>
<text x="${x}" y="70" text-anchor="middle" font-size="10" fill="#2C3E50">${a}m</text>`;
}).join("");
const skippedDots = activities
.filter(a => a > sessionEnd)
.map(a => {
const x = 40 + Math.min(a, totalTime) * scale;
return `<circle cx="${x}" cy="40" r="5" fill="#E74C3C" opacity="0.4"/>`;
}).join("");
const sessionW = sessionEnd * scale;
const maxDurX = 40 + maxDur * scale;
const endX = 40 + sessionEnd * scale;
const rows = activities.map(a => {
const withinSession = a <= sessionEnd;
const gap = a === activities[0] ? a : a - activities[activities.indexOf(a) - 1];
const timedOut = gap > idleTo;
return `<tr style="background:${withinSession ? '#e8f5e9' : '#ffebee'}">
<td style="padding:3px 8px">${a} min</td>
<td style="padding:3px 8px">${gap} min</td>
<td style="padding:3px 8px">${timedOut ? "Exceeds idle timeout" : "Within limit"}</td>
<td style="padding:3px 8px;text-align:center">${withinSession ? "Active" : "Expired"}</td>
</tr>`;
}).join("");
return html`<p class="auth-wide-scroll-hint" id="auth-session-scroll-hint">↔ Scroll horizontally to inspect the complete session timeline and all activity evidence.</p>
<div class="auth-wide-scroll" role="region" tabindex="0" aria-label="Session expiry timeline and activity table" aria-describedby="auth-session-scroll-hint"><div style="font-family:sans-serif">
<svg width="${barWidth + 80}" height="100" style="display:block;margin:8px 0">
<rect x="40" y="30" width="${sessionW}" height="20" fill="#3498DB" opacity="0.3" rx="4"/>
<line x1="40" y1="25" x2="40" y2="55" stroke="#2C3E50" stroke-width="2"/>
<text x="40" y="20" text-anchor="middle" font-size="10" fill="#2C3E50">Start</text>
${actDots}
${skippedDots}
<line x1="${endX}" y1="25" x2="${endX}" y2="55" stroke="#E74C3C" stroke-width="2" stroke-dasharray="4"/>
<text x="${endX}" y="90" text-anchor="middle" font-size="10" fill="#E74C3C">End: ${sessionEnd}m</text>
${maxDurX <= barWidth + 40 ? `<line x1="${maxDurX}" y1="25" x2="${maxDurX}" y2="55" stroke="#E67E22" stroke-width="1" stroke-dasharray="2"/>
<text x="${maxDurX}" y="20" text-anchor="middle" font-size="9" fill="#E67E22">Max: ${maxDur}m</text>` : ""}
</svg>
<div style="background:#f0f7ff;border:1px solid #3498DB;border-radius:6px;padding:12px;margin:8px 0">
<strong style="color:#2C3E50">Session expires at ${sessionEnd} minutes</strong><br/>
<span style="color:#7F8C8D">Reason: ${endReason}</span>
</div>
<table style="border-collapse:collapse;width:100%;font-size:0.85em;margin-top:8px">
<tr style="background:#2C3E50;color:white">
<th style="padding:4px 8px;text-align:left">Activity Time</th>
<th style="padding:4px 8px;text-align:left">Gap From Previous</th>
<th style="padding:4px 8px;text-align:left">Idle Check</th>
<th style="padding:4px 8px;text-align:center">Session State</th>
</tr>
${rows}
</table>
</div></div>`;
}