jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

Create a base api handler for authenticated web socket APIs

Open 3coins opened this issue 2 years ago • 2 comments

Problem

Current jupyter-server code doesn't have a base handler or utility for creating authenticated web socket APIs. An example of an authenticated web socket is present in AuthenticatedZMQStreamHandler. https://github.com/jupyter-server/jupyter_server/blob/77be2f5095db195db6aa872e24b5d49c3b53892b/jupyter_server/base/zmqhandlers.py#L303-L348

When working with authenticated web socket APIs, this code will be duplicated for each handler.

Proposed Solution

  • Create a new WebSocketAPIHandler that new APIs can inherit from. This will contain functions that all jupyter web sockets should inherit, for example, set_default_handlers, initialize, get_compression_options etc.
  • Create a AuthWebSocketAPIHandler that additionally adds authentication for web sockets. This will contain functions, that add authentication for web sockets, for example pre_get and get.

Additional context

3coins avatar Apr 08 '22 00:04 3coins

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Apr 08 '22 00:04 welcome[bot]

cc @bollwyvl @Zsailer I also noticed a WebSocketMixin which has common web socket options; is this something we should move into the base handler as part of this effort? https://github.com/jupyter-server/jupyter_server/blob/77be2f5095db195db6aa872e24b5d49c3b53892b/jupyter_server/base/zmqhandlers.py#L121-L230

3coins avatar Apr 08 '22 00:04 3coins