Skip to content
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

session.regenerate() with regenerate strategy: keep old session data for $session_cookie_discard seconds #134

Closed
hoebelix opened this issue Oct 14, 2021 · 1 comment · Fixed by #143
Labels

Comments

@hoebelix
Copy link

Situation
I am using lua-resty-openidc together with the regenerate strategy. When session.save() gets called by client code, this strategy regenerates the session and the old session data is still available for $session_cookie_discard seconds. In contrast to this, when session.regenerate() gets called by client code, this strategy behaved exactly like the default strategy, i.e. it destroys the old session immediately.

Desired behavior
It would be nice if session.regenerate() would preserve the old session data like session.save() for $session_cookie_discard seconds.

Why?
In my case, lua-resty-openidc calls session.generate() whenever tokens are refreshed. By the explanation above the old session data gets destroyed immediately after the tokens have been refreshed. In case that there are two parallel refreshes, one refresh will fail (because it tries to read data from a no-more existing session) and the user gets logged out.

I think this is closely related to zmartzone/lua-resty-openidc#334

@bungle bungle added the bug label Jan 14, 2022
@bungle
Copy link
Owner

bungle commented Jan 14, 2022

@hoebelix, yes, regenerate on regenerate strategy should not destroy session, it needs to ttl the old session for sure. I'll fix this for 3.9 release. Thanks you for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants