-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Improve session idle timeout, add session lifespan #49855
Improve session idle timeout, add session lifespan #49855
Conversation
💔 Build Failed
|
💔 Build Failed
|
1b2e61e
to
20298ea
Compare
💔 Build Failed
|
💔 Build Failed
|
0959914
to
b80b0e3
Compare
💚 Build Succeeded
|
Note to reviewers: two commits (e143e48 and 7bc88ed) are concerned with how to define special routes which should not extend a user's session. After I wrote this code, @azasypkin pointed out to me that we have an existing mechanism ( Despite its name, this uses an HTTP request header to determine whether to extend a session or not. We both agree that this mechanism could use another look, and perhaps could be rewritten (such as the static route-based options that I defined in the two commits above). However, in the spirit of separation of concerns and making this PR a bit lighter, I opted to defer any such change/s to sometime in the future. So, I reverted these two commits, but left them in the history in the PR for future reference. |
💚 Build Succeeded
|
1f3bc81
to
a79bc07
Compare
a79bc07
to
f92f629
Compare
…bsolute-session-timeout
💚 Build Succeeded |
Previously, the lifespan warning would flash on a user's screen every time they clicked a link, because that would result in an API call to get updated session info. Added a check to prevent that from happening.
💚 Build Succeeded |
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.
Operations stuff LGTM
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.
I apologize for another round of nits. This is functioning really well, nice work!
x-pack/legacy/plugins/security/public/hacks/on_session_timeout.js
Outdated
Show resolved
Hide resolved
💚 Build Succeeded |
💚 Build Succeeded |
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.
LGTM pending merge conflicts/green CI!
…bsolute-session-timeout
💚 Build Succeeded |
This adds an absolute session timeout (lifespan) to user sessions. It also improves the existing session timeout toast and the overall user experience in several ways.
Summary
The core purpose of this PR is to add an absolute timeout, or "lifespan", to user sessions. To facilitate this, changes needed to be made to the existing session idle timeout functionality.
If a lifespan is defined, sessions will expire at that point in time. If an idle timeout is also defined, then sessions can be extended up to the end of that lifespan. When a user is about to reach the end of their session lifespan, they will see a warning toast similar to the existing one for idle session timeout.
Changes to existing functionality are primarily on the client-side. Before, the client was completely unaware of when its session would actually expire -- it would just estimate this based on the injected config values. Now, the client fetches this information from an API, and shares this across tabs to synchronize the timers to all of them. This results in a much better user experience where these popups behave more logically, and one open tab will not erroneously log users out when the session has been extended in another tab.
Deprecates config option
xpack.security.sessionTimeout
, the new name isxpack.security.session.idleTimeout
to better reflect its function.Adds config option
xpack.security.session.lifespan
to control the session lifespan.Note: there is a known bug, #22440, that prevents the session expiration message from showing on multiple tabs. That is partially addressed in this PR (for the
basic
andtoken
auth providers), but it will need to be fully addressed in a separate PR.Resolves #18566.
Resolves #48859.
Screenshots
All warnings and messages now display on multiple tabs.
Added new session lifespan warning with progress indicator and countdown timer:
Modified existing session idle timeout warning to match:
Logout messages now display on all tabs when using
basic
ortoken
auth providers:Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers