-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
[WIP] Add extra check for dashboards behind auth #229
Conversation
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.
Thanks for this @viniciusdc, and sorry for the slow review! The logic looks sound to me (though I haven't been able to test this on a QHub-like deployment). My main request is that we expose this as a setting rather than a "gateway"
URL check.
But I think the best approach should have been something like an
Interceptor
I'm not familiar with this, can you elaborate?
Hi @ian-r-rose thanks for the comments above, I tried to add what you suggested, but I am not sure how to incorporate the changes made to |
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.
Thanks @viniciusdc! Left a few style comments, but I think those could mostly be fixed by getting the pre-commit hooks working.
Regarding passing the option down to the dashboard check: perhaps my earlier suggestion of using an additional option in an IOption
object was overkill, we could also just have a setter on the URLInput
class (since that is the class that actually checks the URL). It's still an unfortunate number of steps, but one fewer than what I suggested before :). So it would look something like
- in
onSettingsChanged
read the new setting value - Update that value using a new setter on
URLInput
- The
URLInput
object then passes the setting value into the dashboard check utility function.
Hi @ian-r-rose, many thanks for the explanation. I tried to implement these changes (I think I understand a little bit more how this works 🙂 ). Let me know your thoughts about this. Thanks in advance |
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.
This is looking pretty good @viniciusdc, I just have one request to add get
accessor, and I think this will be good to go!
src/dashboard.tsx
Outdated
@@ -301,9 +301,11 @@ export class URLInput extends Widget { | |||
/** | |||
* The in browser dashboard check for authenticated dashboards. | |||
*/ | |||
get browserDashboardCheck(): boolean { | |||
return this.browserDashboardCheck; |
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.
These should be underscored attributes to not shadow the method names
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.
uhm I see, I was not sure about how to use _
in there. Thanks @ian-r-rose. So, just to be sure, I only need to change the methods inside the setter/getter, do I also need to change inside the class as well?
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.
Sorry to be terse! Typically what we do is add a private attribute (see the bottom of this class) which is prefixed with an underscore. It's a bit Java-ey, but hopefully not too bad.
So this line would become
return this._browserDashboardCheck;
and further down with the other private attributes you would have
private _browserDashboardCheck = false;
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.
Cool, just added that. Let me know if its correct 🙂
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.
This looks great, thanks for all your work on this @viniciusdc! Looks like pre-commit is unhappy, but for a reason unrelated to this PR, so I'll go ahead and fix that myself.
@viniciusdc, can I ask you to confirm that the PR in this state still works for your use-case, since I'm not set up to test it myself?
Also, cc @jsignell, who has requested a similar option in the past.
Thanks @ian-r-rose for the review, I am currently testing it now will let you know once I finish. Just I question, where should I modify in the config the new attribute to propagate it? |
As a user, you should be able to go to the JupyterLab settings editor (Settings -> Advanced Settings Editor) and find the "Dask" tab. That will open a JSON editor in which you can change the settings. These settings are stored in JSON files on disk (you can find the path to those files if you want to manually edit them by running As a system admin, you'll want to distribute a settings file to your users that have the appropriate values for these settings. That way they won't need to change the settings themselves. This functionality is documented here. |
Whoops, found one more place where we need to pass |
Hi @ian-r-rose, so I was able to toggle the options and I can see the table
|
Okay, this looks good to me if you are happy with it @viniciusdc |
I will check again with this addition, thanks for updating it 🙂 |
Hmm, weird. Do you see anything in the |
I can see two responses, one from
the second one though
with the following body
|
Getting two different responses suggests to me that the issue is with having two different checks to |
Sure, I think that might be the case as well, rebuilding now. |
Hi @ian-r-rose, that did the trick. Thank you, its working flawlessly 😄 |
Great, in it goes, thanks @viniciusdc! |
Thanks for all the help with this @ian-r-rose!! Hope to contribute more in the future with you all! |
Thanks again for this @viniciusdc! I've just published version 5.3.0 of |
closes #225
This does not solve #190 completely but presents a second validation step using only a single
fetch
which enables the request to be performed in the same browser session.There are some points here that I would like to point out:
gateway
in the URL, but that's not ideal. I would like to have another opinion on which mechanic should be used here. I originally thought of passing an extra setting to the lab extension config to enable/disable this optional validation...Interceptor
to verify the response and then move accordingly to that...Well, this issue is fixed in our case with these changes, but I would love to know what I can do to improve this contribution and have such a feature added to main 😄