Skip to content

Commit

Permalink
Better heuristic for @tornado.web.authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Feb 13, 2024
1 parent cd84175 commit 5f6bc16
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,9 @@ def _check_handler_auth(
method = getattr(handler, method_name.lower())
is_unimplemented = method == web.RequestHandler._unimplemented_method
is_allowlisted = hasattr(method, "__allow_unauthenticated")
possibly_blocklisted = hasattr(
method, "__wrapped__"
) # TODO: can we make web.auth leave a better footprint?
if not is_unimplemented and not is_allowlisted and not possibly_blocklisted:
# TODO: modify `tornado.web.authenticated` upstream?
is_blocklisted = method.__code__.co_qualname.startswith("authenticated")
if not is_unimplemented and not is_allowlisted and not is_blocklisted:
missing_authentication.append(
f"- {method_name} of {handler.__name__} registered for {matcher}"
)
Expand Down

0 comments on commit 5f6bc16

Please sign in to comment.