Skip to content

fix(middleware): sliding expiration for remember-me sessions#117

Closed
Copilot wants to merge 2 commits intoworktree-loginfrom
copilot/sub-pr-116
Closed

fix(middleware): sliding expiration for remember-me sessions#117
Copilot wants to merge 2 commits intoworktree-loginfrom
copilot/sub-pr-116

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 21, 2026

SessionIdleTimeout updated SessionLastActivity in the remember-me branch but never called session.Save(), so the cookie expiration never actually slid—only the in-memory value changed.

Changes

  • SessionIdleTimeout — add session.Save() after updating SessionLastActivity in the remember-me branch, so the cookie is rewritten on every request
if session.Get(SessionRememberMe) != nil {
    session.Set(SessionLastActivity, time.Now().Unix())
    _ = session.Save()   // ← was missing; cookie now actually slides
    c.Next()
    return
}
  • TestSessionIdleTimeout_RememberMeUpdatesLastActivity — assert Set-Cookie is present in the response, verifying session.Save() was called (not just the in-memory value)

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…e branch for sliding expiration

Co-authored-by: appleboy <21979+appleboy@users.noreply.github.com>
Agent-Logs-Url: https://github.com/go-authgate/authgate/sessions/1b762db8-27ed-4ba9-8c37-5e2b4f88c6bb
Copy link
Copy Markdown
Author

Copilot AI commented Mar 21, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • invalid-host
    • Triggering command: /tmp/go-build665402482/b001/middleware.test /tmp/go-build665402482/b001/middleware.test -test.testlogfile=/tmp/go-build665402482/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true om/gin-gonic/gin-p cgo_.o ux-amd64/pkg/tool/linux_amd64/compile -I /home/REDACTED/go/env -I ux-amd64/pkg/tooGO111MODULE -W om/mattn/go-sqliGOINSECURE ernal/profile/encode.go ux-amd64/pkg/tool/linux_amd64/compile . om/mattn/go-sqli-m64 --64 ux-amd64/pkg/too/tmp/go-link-828296822/a.out (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add remember-me checkbox for 30-day sessions fix(middleware): sliding expiration for remember-me sessions Mar 21, 2026
Copilot AI requested a review from appleboy March 21, 2026 02:53
@appleboy appleboy closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants