-
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
Store user credentials in cookie/localstorage #257
Comments
After looking into cookies vs localStorage vs sessionStorage, I was wondering if you had a preference as to which we should use. |
sessionStorage is probably the best bet for now, since I think it hardly raises any security concern assuming the user's browser implements it correctly, but it does smooth out the user's experience a fair amount. Eventually we will want some way to do actual user login sessions for basic auth with expiring session tokens that we can store, rather than directly storing the user's credentials, but that's a longer term plan that includes several changes on the backend as well. For Bearer auth, where the user is expected to know how to get credentials from the underlying platform and we hook into that auth server, then I think we are OK to persist those with the user's opt-in. |
I believe this is only needed for things like tracking cookies, for analytics and advertising, but not required for functionality of simply keeping the user signed in to the application. It would apply for cookies as well as local/session storage, too. |
Revisiting this issue again - since #261 intended to remember Basic auth credentials, would you rather I close #261 and then open a new PR, or modify the existing PR to remember Bearer tokens with a checkbox? |
I think #261 is okay as it is since the credentials are only in sessionStorage. Enhancing the existing PR to also store the Bearer token into sessionStorage (with a checkbox to enable this) seems reasonable. |
As of #261, If I understood you correctly, do you mean I could remove
|
More or less, yes - just one piece of string state that holds a token trivially works for the Bearer case. For the basic case, the In cryostatio/cryostat#703, |
Thanks, in that case, I'll assign myself to #317 and work from there |
Does this issue apply to JMX credentials as well? Whenever I refresh the page, I need to enter JMX credentials every time I want to see the Recordings tab. |
It could, but we should also think about storing JMX credentials server-side. We already do that for automated rules, so it's just a matter of adding a couple of lines of code to enable the same functionality elsewhere. See also cryostatio/cryostat#565 |
ie when a successful connection is opened then we can store (in memory for now, until we figure out the security requirements for persistent them to disk) those credentials in the CredentialsManager. If we try to open a connection using stored credentials and it fails due to the credentials being incorrect then we should probably automatically remove those stored credentials. We might also want to build a simple API and UI for listing targets that have stored credentials - without revealing any information about what those credentials are of course - so that users can delete stored credentials graphically. For example, for old targets that they no longer need to connect to, or for targets that have been redeployed and where the user knows in advance that the required credentials have changed. |
I think this can be closed now that we properly delegate out to the platform OAuth server, right? |
Yes, thanks for checking on this. |
The user
basic auth (bearer (token) credentials should be persisted, such that upon Cryostat web-client reload or new tab opening the user is not required to re-enter their credentials. These credentials must also be persisted in a way that they are unique per Cryostat instance (distinguished by domain) and in a way that they are private to the web-client instance for a given domain (no cross-origin access).base64(username:password)
) orThere should also be a corresponding user menu added to the page masthead to allow users to "log out" of the web-client by clearing the stored credentials.
https://www.patternfly.org/v4/components/page/design-guidelines/#masthead
EDIT: actually, in the case that we detect the server is expecting Basic authorization, we should not offer the option to persist these credentials until we have backend support for creating a user session using these credentials. Otherwise we're writing their password to plaintext, which we don't want to do.
Saving the Bearer (JWT) tokens is acceptable, I think, but there should still be a checkbox or something to allow the user to opt-out of having these persisted.
The text was updated successfully, but these errors were encountered: