mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 22:43:00 +00:00
multiuser pkg
This commit is contained in:
@@ -24,7 +24,7 @@ Basic principals:
|
|||||||
|
|
||||||
## to use
|
## to use
|
||||||
|
|
||||||
$> python -m multiuser_notebook
|
$> python -m multiuser
|
||||||
|
|
||||||
visit `http://localhost:8000`, and login (any username, password=`password`).
|
visit `http://localhost:8000`, and login (any username, password=`password`).
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@ auth_header_pat = re.compile(r'^token\s+([^\s]+)$')
|
|||||||
here = os.path.dirname(__file__)
|
here = os.path.dirname(__file__)
|
||||||
|
|
||||||
def token_authorized(method):
|
def token_authorized(method):
|
||||||
|
"""decorator for a method authorized by the Authorization header"""
|
||||||
def check_token(self, *args, **kwargs):
|
def check_token(self, *args, **kwargs):
|
||||||
auth_header = self.request.headers.get('Authorization', '')
|
auth_header = self.request.headers.get('Authorization', '')
|
||||||
match = auth_header_pat.match(auth_header)
|
match = auth_header_pat.match(auth_header)
|
||||||
@@ -52,6 +53,8 @@ def token_authorized(method):
|
|||||||
raise web.HTTPError(403)
|
raise web.HTTPError(403)
|
||||||
self.request_session = session
|
self.request_session = session
|
||||||
return method(self, *args, **kwargs)
|
return method(self, *args, **kwargs)
|
||||||
|
check_token.__name__ = method.__name__
|
||||||
|
check_token.__doc__ = method.__doc__
|
||||||
return check_token
|
return check_token
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +101,7 @@ class UserSession(HasTraits):
|
|||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
assert self.process is None or self.process.poll() is not None
|
assert self.process is None or self.process.poll() is not None
|
||||||
cmd = [sys.executable, '-m', 'multiuser_notebook.singleuser',
|
cmd = [sys.executable, '-m', 'multiuser.singleuser',
|
||||||
'--user=%s' % self.user, '--port=%i' % self.port,
|
'--user=%s' % self.user, '--port=%i' % self.port,
|
||||||
'--cookie-name=%s' % self.cookie_name,
|
'--cookie-name=%s' % self.cookie_name,
|
||||||
'--multiuser-prefix=%s' % self.multiuser_prefix,
|
'--multiuser-prefix=%s' % self.multiuser_prefix,
|
Reference in New Issue
Block a user