-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting and creating a new session on the same request causes dangling? #11
Comments
I saw your issue, just didn't have time for it yet. Will look into it soon. |
No pressure :) Thanks for responding! For now I just patched my fork with: // SetTimeout modifies the timeout the session currently has.
func (s *Impl) SetTimeout(d time.Duration) {
s.TimeoutF = d
} This is probably not the prettiest method, but it works. It seems deleting and creating a new session in the same request/response cycle confuses the manager. |
Ok, so some questions.
I looked into the implementation, and by default (if you use the default manager and store which is So |
I'm using the default session.Global.Close()
sessStore := session.NewInMemStoreOptions(&session.InMemStoreOptions{
DebugMode: "prod" != *config.ClFlagEnvironment,
})
session.Global = session.NewCookieManagerOptions(sessStore, &session.CookieMngrOptions{
SessIDCookieName: config.Values.Security.SessionCookieName,
}) By accident I noticed that after doing a redirect after removing the session on logout it also didn't unset, but only after the second navigation/refresh it completed the session/cookie update. Maybe it has something to do with creating/removing and redirecting afterwards? As that's what happens after the login redirect too. And maybe that caused the 2 sessions to come to exist. |
I'm not sure, but I guess you can easily test that (by not redirecting). |
Say I have these two functions for my framework where I need to respawn the session if someone already has session values but chose
Remember Me
at login. I'm trying to respawn a new session with the old attributes and a new, longer, expiration time:Even tho I expect a delete and an add, the session-logger tells me one is
deleted
but two times shows meadded
. When I dump the internalsessions
it still has the old (deleted) session too with it's old variables.The following code is used in my login page (
sessiondb
is simply a small layer to automatisesession
existences checks):In the above case;
LoginReferer
UserID
andLoginReferer
, which of course is consumed again right away if it was set to jump back to where to user was before being bounced to the login page (e.a. authorised environment)The text was updated successfully, but these errors were encountered: