-
-
Notifications
You must be signed in to change notification settings - Fork 987
feat: Option to allow regenerate() to preserve old session #419
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I think this is a great feature to add and make sense to me. I really only have two asks:
- We'll need to get documentation added to the README.
- I feel like the API is a little weird, and generally feel like APIs that take a Boolean as a random argument is hard to remember that a
true
means without looking it up and also it's even odder to have arguments appearing after a callback argument. I would think maybe the API bereq.session.regenerate({ preserve: true }, callback)
I have pushed another commit to address the comments from @dougwilson. Let me know if you want me to squash the commits. |
Hi @mccleanp thanks for updating the PR! What ever happened to the |
@dougwilson: I am happy to change it back to |
Yea, if you have a better idea for the terminology, that's great, just the key constraint I'm trying to keep here is that the default value should be |
I just rebased the commits. I'm going to work on cleaning it up further to merge 👍 |
Add preserve option to session.regenerate() function for use cases when it is desirable to regenerate the session, but not destroy the old session immediately. For example when there could be multiple ajax requests inflight with the old session id. Existing functionality is preserved if the option is omitted. Existing test was improved to cover session destuction and new test was added for the preserve case.
I currently have a problem is that the previous sessionStore got delete after run regenerate() function. Not sure is it could be solved with this PR. but I think to let the old sessionStore expire itself by |
9d2e29b
to
408229e
Compare
Add preserve option to session.regenerate() function for use cases when it is desirable to regenerate the session, but not destroy the old session immediately. For example when there could be multiple ajax requests inflight with the old session id.
Existing functionality is preserved if the option is omitted. Existing test was improved to cover session destuction and new test was added for the preserve case.
This was motivated by the desire to implement middleware to provide session renewal, as recommended by OWASP