Skip to content

Commit 6b7214a

Browse files
committed
Remove jupyter-server Authentication
1 parent a094be8 commit 6b7214a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

jupyter_server_proxy/standalone/hub.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
from jupyterhub import __version__ as __jh_version__
44
from jupyterhub.services.auth import HubOAuthenticated
55
from jupyterhub.utils import make_ssl_context
6-
from tornado import httpclient
6+
from tornado import httpclient, web
77
from tornado.log import app_log as log
88

9-
from ..handlers import ProxyHandler
109
from .proxy import StandaloneProxyHandler
1110

1211

13-
class StandaloneHubProxyHandler(StandaloneProxyHandler, HubOAuthenticated):
12+
class StandaloneHubProxyHandler(HubOAuthenticated, StandaloneProxyHandler):
1413
"""
1514
Standalone Proxy used when spawned by a JupyterHub.
1615
Will restrict access to the application by authentication with the JupyterHub API.
@@ -28,9 +27,9 @@ def hub_groups(self):
2827
return {self.settings["hub_group"]}
2928
return set()
3029

31-
def prepare(self, *args, **kwargs):
32-
# Enable Authentication Check
33-
return ProxyHandler.prepare(self, *args, **kwargs)
30+
@web.authenticated
31+
async def proxy(self, port, path):
32+
return await super().proxy(port, path)
3433

3534
def set_default_headers(self):
3635
self.set_header("X-JupyterHub-Version", __jh_version__)

jupyter_server_proxy/standalone/proxy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ def __init__(self, *args, **kwargs):
7070

7171
settings = dict(
7272
debug=debug,
73-
# Required for JupyterHub Authentication
73+
# Required for JupyterHub
7474
hub_user=os.environ.get("JUPYTERHUB_USER", ""),
7575
hub_group=os.environ.get("JUPYTERHUB_GROUP", ""),
76+
cookie_secret=os.urandom(32),
7677
)
7778

7879
if websocket_max_message_size:

0 commit comments

Comments
 (0)