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

Auto logout #908

Merged
merged 5 commits into from
Sep 4, 2018
Merged

Auto logout #908

merged 5 commits into from
Sep 4, 2018

Conversation

bjoernricks
Copy link
Contributor

Implement auto logout feature. Using the feature needs an up to date gsad.

It's more a LocationObserver because it renews the user session if the
url location has changed.
The ping command just responses an action result. It's intended to test
if the user session is still valid. It doesn't extend the session. If
the session is due a 401 response is returned by gsad.
The SessionObserver is responsible for issuing a ping request 15 seconds
after the user session has ended to return a 401 response that will
redirect to the login page. This feature is called auto logout.

Technically the SessionObserver renders a Ping component that starts a
timer on mount and removes the timer on unmount. SessionObserver uses a
super-duper reactjs feature that changing the key on a component will
always unmount and re-mount the component (see https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key)
for more details. This allows easy cancelling of the timer (via unmount)
instead of having to synchronize user session state changes via
componentWillReceiveProps, getDerivedStateFromProps and
componentDidUpdate like methods.
@codecov
Copy link

codecov bot commented Sep 4, 2018

Codecov Report

Merging #908 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #908      +/-   ##
=========================================
- Coverage    7.36%   7.35%   -0.02%     
=========================================
  Files         826     827       +1     
  Lines       26936   26982      +46     
  Branches     5703    5687      -16     
=========================================
  Hits         1984    1984              
- Misses      22544   22586      +42     
- Partials     2408    2412       +4
Impacted Files Coverage Δ
gsa/src/web/components/observer/sessionobserver.js 0% <0%> (ø) ⬆️
gsa/src/web/routes.js 0% <0%> (ø) ⬆️
...sa/src/web/components/observer/locationobserver.js 0% <0%> (ø)
gsa/src/gmp/commands/users.js 3.61% <0%> (-0.09%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59ce350...4a86521. Read the comment docs.

@swaterkamp swaterkamp merged commit da5e44a into greenbone:master Sep 4, 2018
@bjoernricks bjoernricks deleted the auto-logout branch September 4, 2018 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants