mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 14:03:02 +00:00
give Spawners a handle on the Authenticator
band-aid for spawner-authenticator pairs
This commit is contained in:
@@ -711,6 +711,7 @@ class JupyterHub(Application):
|
|||||||
self.log.debug("Loading state for %s from db", user.name)
|
self.log.debug("Loading state for %s from db", user.name)
|
||||||
user.spawner = spawner = self.spawner_class(
|
user.spawner = spawner = self.spawner_class(
|
||||||
user=user, hub=self.hub, config=self.config, db=self.db,
|
user=user, hub=self.hub, config=self.config, db=self.db,
|
||||||
|
authenticator=self.authenticator,
|
||||||
)
|
)
|
||||||
status = yield spawner.poll()
|
status = yield spawner.poll()
|
||||||
if status is None:
|
if status is None:
|
||||||
|
@@ -265,6 +265,7 @@ class BaseHandler(RequestHandler):
|
|||||||
base_url=self.base_url,
|
base_url=self.base_url,
|
||||||
hub=self.hub,
|
hub=self.hub,
|
||||||
config=self.config,
|
config=self.config,
|
||||||
|
authenticator=self.authenticator,
|
||||||
)
|
)
|
||||||
@gen.coroutine
|
@gen.coroutine
|
||||||
def finish_user_spawn(f=None):
|
def finish_user_spawn(f=None):
|
||||||
|
@@ -336,7 +336,7 @@ class User(Base):
|
|||||||
return db.query(cls).filter(cls.name==name).first()
|
return db.query(cls).filter(cls.name==name).first()
|
||||||
|
|
||||||
@gen.coroutine
|
@gen.coroutine
|
||||||
def spawn(self, spawner_class, base_url='/', hub=None, config=None):
|
def spawn(self, spawner_class, base_url='/', hub=None, authenticator=None, config=None):
|
||||||
"""Start the user's spawner"""
|
"""Start the user's spawner"""
|
||||||
db = inspect(self).session
|
db = inspect(self).session
|
||||||
if hub is None:
|
if hub is None:
|
||||||
@@ -357,6 +357,7 @@ class User(Base):
|
|||||||
user=self,
|
user=self,
|
||||||
hub=hub,
|
hub=hub,
|
||||||
db=db,
|
db=db,
|
||||||
|
authenticator=authenticator,
|
||||||
)
|
)
|
||||||
# we are starting a new server, make sure it doesn't restore state
|
# we are starting a new server, make sure it doesn't restore state
|
||||||
spawner.clear_state()
|
spawner.clear_state()
|
||||||
|
@@ -39,6 +39,7 @@ class Spawner(LoggingConfigurable):
|
|||||||
db = Any()
|
db = Any()
|
||||||
user = Any()
|
user = Any()
|
||||||
hub = Any()
|
hub = Any()
|
||||||
|
authenticator = Any()
|
||||||
api_token = Unicode()
|
api_token = Unicode()
|
||||||
ip = Unicode('localhost', config=True,
|
ip = Unicode('localhost', config=True,
|
||||||
help="The IP address (or hostname) the single-user server should listen on"
|
help="The IP address (or hostname) the single-user server should listen on"
|
||||||
|
Reference in New Issue
Block a user