jupyterhub / tmpauthenticator

JupyterHub authenticator that hands out temporary accounts for everyone. For use in tmpnb.org
BSD 3-Clause "New" or "Revised" License
23 stars 18 forks source link

Should TmpAuthenticator replace traitlets with booleans, or provide a new default value? #40

Closed consideRatio closed 1 year ago

consideRatio commented 1 year ago

If we have it like this, I think it makes it impossible for the user to change auto_login if they would like to. Is it a better practice to provide a new default value for the super class' existing auto_login traitlet?

https://github.com/jupyterhub/tmpauthenticator/blob/fb444abda4bc7439ff958648dc450a69a688da55/tmpauthenticator/__init__.py#L52-L52

I'm thining for example like:

from traitlets import default

class TmpAuthenticator(Authenticator):
    @default("auto_login")
    def _auto_login_default(self):
        return True

Related

From jupyterhub's auth.py.

    auto_login = Bool(
        False,
        config=True,
        help="""Automatically begin the login process

        rather than starting with a "Login with..." link at `/hub/login`

        To work, `.login_url()` must give a URL other than the default `/hub/login`,
        such as an oauth handler or another automatic login handler,
        registered with `.get_handlers()`.

        .. versionadded:: 0.8
        """,
    )
yuvipanda commented 1 year ago

Might be useful to try it out, would allow us to have an actual home page with a 'login' button. This wasn't required for tmpnb so we didn't support it. We could support it now.

yuvipanda commented 1 year ago

@consideRatio turns out this is simpler than I thought :) Here's a (mostly docs) PR https://github.com/jupyterhub/tmpauthenticator/pull/41