diff --git a/jupyterhub/auth.py b/jupyterhub/auth.py index a918a311..11e23bf0 100644 --- a/jupyterhub/auth.py +++ b/jupyterhub/auth.py @@ -114,11 +114,13 @@ class Authenticator(LoggingConfigurable): This forces :meth:`.refresh_user` to be called prior to stopping a server, to ensure that auth state is up-to-date. - This can be important when e.g. auth tokens that may have expired - are passed to the spawner via environment variables from auth_state. + This can be important when e.g. auth tokens stored in auth_state may have expired, + but are a required part of the Spawner's shutdown steps. If refresh_user cannot refresh the user auth data, stop will fail until the user logs in again. + + .. versionadded:: 5.4 """, ) diff --git a/jupyterhub/tests/test_auth_expiry.py b/jupyterhub/tests/test_auth_expiry.py index 3db11f4b..6a6b8593 100644 --- a/jupyterhub/tests/test_auth_expiry.py +++ b/jupyterhub/tests/test_auth_expiry.py @@ -41,10 +41,8 @@ def refresh_pre_spawn(app): def refresh_pre_stop(app): """Fixture enabling auth refresh pre stop""" app.authenticator.refresh_pre_stop = True - try: - yield - finally: - app.authenticator.refresh_pre_stop = False + yield + app.authenticator.refresh_pre_stop = False async def test_auth_refresh_at_login(app, user):