Skip to content

Commit

Permalink
decode bytes from secure cookie
Browse files Browse the repository at this point in the history
The get_secure_cookie interface returns bytes not str

https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.get_secure_cookie

This fixes a minor issue where `handler.get_current_user` would return
bytes rather than str.
  • Loading branch information
oliver-sanders committed Jul 28, 2021
1 parent 52e9467 commit c8a3438
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jupyter_server/auth/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def get_user(cls, handler):
if user_id is None:
get_secure_cookie_kwargs = handler.settings.get('get_secure_cookie_kwargs', {})
user_id = handler.get_secure_cookie(handler.cookie_name, **get_secure_cookie_kwargs )
if user_id:
user_id = user_id.decode()
else:
cls.set_login_cookie(handler, user_id)
# Record that the current request has been authenticated with a token.
Expand Down

0 comments on commit c8a3438

Please sign in to comment.