-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add session timeout support #8250
Add session timeout support #8250
Conversation
87daac4
to
63bd17e
Compare
Build succeeded.
|
addresses #4205 |
Neat Diagram. Edit: Helpful as well! |
97ab1c1
to
bbb9897
Compare
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.
Thank you for writing detailed and thorough documentation! Found a couple issues and discussed them with @jakemcdermott. One issue was due to the API allowing a delay of ~950 years, but JavaScript timers (setInterval and setTimeout) allow a max delay of 2147483647
seconds.
The fixes look good to me! I only have one nitpick but otherwise 👍
bdeb6f1
to
39a532f
Compare
Build succeeded.
|
@jakemcdermott we won't be adding automated coverage for session timeouts. I would like to put this into needs_test to 🔨 on it for an hour. Let me know when it's in a state that's appropriate -- even it if is just a needs_test ticket post merge |
@unlikelyzero Sounds good. I intend to move this over to needs test in the next day or so. I'll add the tag and ping. |
0b8a2fa
to
b82174d
Compare
Build succeeded.
|
b82174d
to
3e02b85
Compare
Build succeeded.
|
3e02b85
to
25d2773
Compare
Build succeeded.
|
May need to add |
25d2773
to
bd2801f
Compare
Build succeeded.
|
Added stubs for session time out in 5743 |
Intercept all http(s) responses and store expiration time from headers in local storage. Drive expiration timers in app container across all tabs with browser storage events and accompanying react hooks integration. Show a warning with logout countdown and continue button when session is nearly expired.
If the remaining session time dips below 0 imediately before auto- logout, ceil the display value to 0 to avoid showing negative seconds left.
bd2801f
to
487bf50
Compare
Build succeeded.
|
Build succeeded (gate pipeline).
|
SUMMARY
Intercept HTTP(S) responses and store expiration time from headers in web storage. Drive expiration timers in app container across all tabs with browser storage events and accompanying react hooks integration. Show a warning with logout countdown and continue button when session is nearly expired.
Local Storage Integration
The
useStorage
hook integrates with the browser's localStorage api. It accepts a localStorage key as its only argument and returns a state variable and setter function for that state variable. When local storage is shared, the hook enables bidirectional data transfer between tabs via an event listener that is registered with the Web Storage api. This means that updates to the state variable using the setter function on one tab will also update the state variable on any other tab using this hook with the same key and vice-versa.The
useStorage
hook currently lives in theAppContainer
component. It can be relocated to a more general location should and if the need ever ariseSession Expiration
Session timeout state is communicated to the client in the HTTP(S) response headers. Every HTTP(S) response is intercepted to read the session expiration time before being passed into the rest of the application. A timeout date is computed from the intercepted HTTP(S) headers and pushed into local storage, where it can be read using standard Web Storage apis or other utilities, such as
useStorage
.ADDITIONAL INFORMATION