ideonate / cdsdashboards

JupyterHub extension for ContainDS Dashboards
https://cdsdashboards.readthedocs.io/
Other
200 stars 38 forks source link

Get auth_state from hub-info/user #51

Closed fcollonval closed 3 years ago

fcollonval commented 3 years ago

Is your feature request related to a problem? Please describe.

N/A

Describe the solution you'd like

Follow-up of #28

It could be interesting to get the auth_state too as part of the user information obtain from hub-info/user.

Describe alternatives you've considered

N/A

Background context

User information obtained from the authenticator could be useful inside a dashboard to tweak request to internal data server or services.

Configuration

JHub: 1.2 cdsdashboard: 0.4.1

danlester commented 3 years ago

Hello @fcollonval - great to hear from you!

This idea sounds useful, although would definitely need some thought from each JupyterHub admin as to whether it's safe. I think the assumption is generally that the auth_state is a server-side thing, and certainly might contain login tokens to other services such as GitHub.

At the very least I think it would have to be off by default! Let me know if you have any other thoughts.

Is there any use case in particular you have in mind where this would be useful?

On an off-by-default basis, I think it would probably be reasonable to have this functionality in the main codebase anyway. If you have any code then feel free to PR, otherwise at least the issue is open here and I (or someone else) might be able to pick it up in the new year.

Thanks for the suggestion!

fcollonval commented 3 years ago

Great, I agree with you on the security aspect. So I'll push a PR with the feature off by default.

As a side-effect, I have coded a UserWidget based on @ricky-lim and your gist. Would it make sense for you to include it in the companion extension?

ricky-lim commented 3 years ago

Good to hear that.

For me one of my use case is to render a table personalized to a different user.

Currently, with a fetch widget, ipyfetch, a user needs to click a button to fetch the current user.

Ideally I wish to get the current user while loading the widgets with voila. That would be awesome if possible 😃

Cheers

fcollonval commented 3 years ago

Ideally I wish to get the current user while loading the widgets with voila. That would be awesome if possible 😃

That is definitely possible - my widget variant is doing that in fact. I hope to find time to push a PR on the companion extension then.