Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Starting notebook session with a password protected server #109

Open
geyang opened this issue Mar 13, 2016 · 6 comments
Open

Starting notebook session with a password protected server #109

geyang opened this issue Mar 13, 2016 · 6 comments

Comments

@geyang
Copy link

geyang commented Mar 13, 2016

Hi,

Sorry if this is already implemented. I looked for the options to connect to password protected notebooks with the service. Is this possible?

Thanks!
Ge

@blink1073
Copy link
Contributor

Hi @episodeyang, I am not familiar with how password protecting is handled normally in notebooks, perhaps @minrk can answer that part. My guess is that you would set the password field in the ajaxSettings in the NotebookSession.

https://github.com/jupyter/jupyter-js-utils/blob/master/src/index.ts#L169

@minrk
Copy link
Member

minrk commented Mar 13, 2016

With the current notebook server, you must login with a password, which sets a cookie, and the cookie must be used with all subsequent requests. We've discussed adding token authentication via headers, but it hasn't happened yet.

@geyang
Copy link
Author

geyang commented Mar 20, 2016

@minrk Thanks!

@blink1073 yeah so the problem right now is that the auth is cookie based, so unless the user manually pass the cookie along, a javascript client can not connect to a password protected server because as soon as you connect, the server redirects which prevents a js client to get the cookie information.

Ge

@blink1073
Copy link
Contributor

Does using withCredentials not work? https://github.com/jupyter/jupyter-js-utils/blob/master/src/index.ts#L159

I believe @parente is already using it.

@parente
Copy link
Member

parente commented Mar 21, 2016

withCredentials should work but we're not using it at the moment. Instead of running notebook servers which have human-centric auth, we're running kernel gateway servers which support programmatic, token-based Authorization: token <token value> headers. (http://jupyter-kernel-gateway.readthedocs.org/en/latest/config-options.html, auth_token option)

@episodeyang are you bound to notebooks and the notebook server specifically? If not, you might want to look at kernel gateway.

@rolweber
Copy link

IBM's Spark as a Service on Bluemix provides a kernel gateway protected with basic auth. But the sample code [1] has to jump through loops to get it working. ajaxSettings provide user ID and password for the API calls, but not for the websocket connection. So the user ID and password has to be mangled into the web socket URL, too.
I just tried setting withCredentials in my node.js client program, but still need to provide both. Should that flag enable passing of uid/pwd from ajaxSettings to the web socket options? From the description, it doesn't sound like it, at least if the web socket connects to the same host as the API calls.

[1] step 2 at https://console.ng.bluemix.net/docs/services/AnalyticsforApacheSpark/index-gentopic4.html#running_spark_interactive_api_app

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants