-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(auth): Store credentials in sessionStorage #261
Conversation
2a23bb8
to
1880d06
Compare
When the
If I quickly login, then logout, then login again, then logout again, the Cryostat web server will send a web socket error saying Since there may be a slight delay in between processing the auth request to disconnecting clients, and
|
It sounds like you might need to add some logic to the Specifically, you'll probably want to close the websocket ( |
6bd820d
to
23ce865
Compare
@andrewazores Thanks for your help so far, this PR is ready for review |
Seems to behave as expected when using the BasicAuthManager. With NoopAuthManager, the login screen appears but there is also a blank user avatar icon in the masthead. This seems okay for now, since the backend doesn't really emulate an actual auth challenge login flow when using the NoopAuthManager. Once the backend does properly support user sessions we can do something better here. I did twice see websocket repeated websocket connection failures with error notifications appearing after a page refresh, but I'm not sure how to reproduce that. I'll see if I can figure it out. |
When I use the BasicAuthManager and first log in to the web-client, then go to Recordings and select a target, only the Active Recording List is shown (Archives are disabled). If I refresh the page, the Archived recordings tab appears. I can reproduce this by logging out, closing the tab, re-opening the tab, and then signing back in and going to Recordings. |
Just tested it with the typical smoketest/webpack-dev-server setup and it looks and works great for both Basic auth and no auth. I'll try it out soon in OpenShift with Bearer auth. One note I have is that the new Login.service holds state for both a username and a token, but only one of these will ever be in use at a time depending on the auth configuration of the server. Could you find a way to refactor the service and the components that access it so that there is just one piece of stored state that is interpreted as either a username or a token depending on the detected auth method? I'm fine with this being done as a follow-up PR, in fact I would prefer that since it will make the review a bit easier. |
Sounds good. I was also wondering if there's a way to display a username from the OpenShift auth implementation. We can continue this discussion in the follow up PR |
I do think we can add something in the backend to query the OpenShift auth server and get the username back from the Bearer token: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#tokenreview-request-0 We already use TokenReviews to check if the user's supplied token is valid in cases where the user does not require any additional resource permissions (ex. create recordings) - so we could create ex. |
Related #257
Creates a user session that will remember credentials after the browser tab is refreshed and will only forget the credentials when the user logs out or closes the tab. If Cryostat was configured with Basic authentication, the user menu will display the username and display a user icon otherwise.
Since this PR only changes the frontend, backend support would likely be required for further security improvements.