Added configurable sliding expiration #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @JamesRitchie ,
I was able to use your work in one of the APIs I'm working on. That saved me a lot of time. Thanks a lot. I had to customize it a bit though as I couldn't allow the token to be valid for days. I introduced sliding token expiration. Yes, much like how sessions are handled in typical web applications. The thing is I'm creating an API that is mobile-ready but can also double as a web application backend.
Basically, if the token expires but a request makes it to the slide window, the token's creation time is set to the current time thereby extending the life span of the same token by another X minutes or so depending on the life span setting. Of course, you already know how this works. (:
Aside from the primary sources, I updated the tests, and a handful of lines in the README file. It could use a code review and an optimization though. Feel free to do whatever you want with this now.
Thanks!