mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 16:03:00 +00:00
DEV: Make login a base-class default on Authenticator.get_handlers.
Rather than a module-level default. Makes it easier for custom Authenticators to unmount /login.
This commit is contained in:
@@ -12,6 +12,7 @@ import simplepam
|
|||||||
from IPython.config import LoggingConfigurable
|
from IPython.config import LoggingConfigurable
|
||||||
from IPython.utils.traitlets import Bool, Set, Unicode
|
from IPython.utils.traitlets import Bool, Set, Unicode
|
||||||
|
|
||||||
|
from .handlers.login import LoginHandler
|
||||||
from .utils import url_path_join
|
from .utils import url_path_join
|
||||||
|
|
||||||
class Authenticator(LoggingConfigurable):
|
class Authenticator(LoggingConfigurable):
|
||||||
@@ -70,7 +71,9 @@ class Authenticator(LoggingConfigurable):
|
|||||||
|
|
||||||
(e.g. for OAuth)
|
(e.g. for OAuth)
|
||||||
"""
|
"""
|
||||||
return []
|
return [
|
||||||
|
('/login', LoginHandler),
|
||||||
|
]
|
||||||
|
|
||||||
class LocalAuthenticator(Authenticator):
|
class LocalAuthenticator(Authenticator):
|
||||||
"""Base class for Authenticators that work with local *ix users
|
"""Base class for Authenticators that work with local *ix users
|
||||||
@@ -156,4 +159,4 @@ class PAMAuthenticator(LocalAuthenticator):
|
|||||||
bpassword = data['password'].encode(self.encoding)
|
bpassword = data['password'].encode(self.encoding)
|
||||||
if simplepam.authenticate(busername, bpassword, service=self.service):
|
if simplepam.authenticate(busername, bpassword, service=self.service):
|
||||||
return username
|
return username
|
||||||
|
|
||||||
|
@@ -69,7 +69,8 @@ class LoginHandler(BaseHandler):
|
|||||||
)
|
)
|
||||||
self.finish(html)
|
self.finish(html)
|
||||||
|
|
||||||
|
|
||||||
|
# Only logout is a default handler.
|
||||||
default_handlers = [
|
default_handlers = [
|
||||||
(r"/login", LoginHandler),
|
|
||||||
(r"/logout", LogoutHandler),
|
(r"/logout", LogoutHandler),
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user