Skip to content

Commit

Permalink
fix: tell browser about cookie expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
lesam committed Mar 15, 2022
1 parent 7d310c2 commit 3ab1bff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions session/http_server.go
Expand Up @@ -165,9 +165,10 @@ const cookieSessionName = "influxdb-oss-session"

func encodeCookieSession(w http.ResponseWriter, s *influxdb.Session) {
c := &http.Cookie{
Name: cookieSessionName,
Value: s.Key,
Path: "/api/",
Name: cookieSessionName,
Value: s.Key,
Path: "/api/",
Expires: s.ExpiresAt,
}

http.SetCookie(w, c)
Expand Down
2 changes: 1 addition & 1 deletion session/http_server_test.go
Expand Up @@ -58,7 +58,7 @@ func TestSessionHandler_handleSignin(t *testing.T) {
password: "supersecret",
},
wants: wants{
cookie: "influxdb-oss-session=abc123xyz; Path=/api/",
cookie: "influxdb-oss-session=abc123xyz; Path=/api/; Expires=Thu, 26 Sep 2030 00:00:00 GMT",
code: http.StatusNoContent,
},
},
Expand Down

0 comments on commit 3ab1bff

Please sign in to comment.