Skip to content

Commit

Permalink
Merge pull request #3778 from beledouxdenis/master-get_secure_cookie_…
Browse files Browse the repository at this point in the history
…options

[FIX] notebookapp, auth: `get_secure_cookie` kwargs
  • Loading branch information
minrk authored Jul 30, 2018
2 parents 1d17c79 + 3729dd0 commit ceaf1c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion notebook/auth/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def get_user(cls, handler):
return handler._user_id
user_id = cls.get_user_token(handler)
if user_id is None:
user_id = handler.get_secure_cookie(handler.cookie_name)
get_secure_cookie_kwargs = handler.settings.get('get_secure_cookie_kwargs', {})
user_id = handler.get_secure_cookie(handler.cookie_name, **get_secure_cookie_kwargs )
else:
cls.set_login_cookie(handler, user_id)
# Record that the current request has been authenticated with a token.
Expand Down
5 changes: 5 additions & 0 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ def _update_webapp_settings(self, change):
help=_("Extra keyword arguments to pass to `set_secure_cookie`."
" See tornado's set_secure_cookie docs for details.")
)
get_secure_cookie_kwargs = Dict(config=True,
help=_("Extra keyword arguments to pass to `get_secure_cookie`."
" See tornado's get_secure_cookie docs for details.")
)
ssl_options = Dict(config=True,
help=_("""Supply SSL options for the tornado HTTPServer.
See the tornado docs for details."""))
Expand Down Expand Up @@ -1338,6 +1342,7 @@ def init_webapp(self):
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat)
self.tornado_settings['allow_credentials'] = self.allow_credentials
self.tornado_settings['cookie_options'] = self.cookie_options
self.tornado_settings['get_secure_cookie_kwargs'] = self.get_secure_cookie_kwargs
self.tornado_settings['token'] = self.token
if (self.open_browser or self.file_to_run) and not self.password:
self.one_time_token = binascii.hexlify(os.urandom(24)).decode('ascii')
Expand Down

0 comments on commit ceaf1c1

Please sign in to comment.