1
0
forked from baron/baron-sso

세션 만료 관리 토글 동작을 실제 정책에 맞게 분리

This commit is contained in:
2026-04-06 13:19:05 +09:00
parent 8942c78fb4
commit 6a3bb19e7d
7 changed files with 217 additions and 4 deletions

View File

@@ -43,3 +43,34 @@ export function shouldAttemptSlidingSessionRenew({
return true;
}
export function shouldAttemptUnlimitedSessionRenew({
expiresAtSec,
nowMs,
isEnabled,
isAuthenticated,
isLoading,
isRenewInFlight,
lastAttemptAtMs,
thresholdMs = SESSION_RENEW_THRESHOLD_MS,
throttleMs = SESSION_RENEW_THROTTLE_MS,
}: SlidingSessionRenewDecisionParams) {
if (isEnabled || !isAuthenticated || isLoading || isRenewInFlight) {
return false;
}
if (typeof expiresAtSec !== "number") {
return false;
}
const remainingMs = expiresAtSec * 1000 - nowMs;
if (remainingMs <= 0 || remainingMs > thresholdMs) {
return false;
}
if (nowMs - lastAttemptAtMs < throttleMs) {
return false;
}
return true;
}