|
83 | 83 | from IPython.utils.localinterfaces import LOCALHOST
|
84 | 84 | from IPython.utils import submodule
|
85 | 85 | from IPython.utils.traitlets import (
|
86 |
| - Dict, Unicode, Integer, List, Bool, |
| 86 | + Dict, Unicode, Integer, List, Bool, Bytes, |
87 | 87 | DottedObjectName
|
88 | 88 | )
|
89 | 89 | from IPython.utils import py3compat
|
@@ -164,7 +164,7 @@ def init_settings(self, ipython_app, kernel_manager, notebook_manager,
|
164 | 164 | static_url_prefix = url_path_join(base_project_url,'/static/'),
|
165 | 165 |
|
166 | 166 | # authentication
|
167 |
| - cookie_secret=os.urandom(1024), |
| 167 | + cookie_secret=ipython_app.cookie_secret, |
168 | 168 | login_url=url_path_join(base_project_url,'/login'),
|
169 | 169 | read_only=ipython_app.read_only,
|
170 | 170 | password=ipython_app.password,
|
@@ -338,6 +338,15 @@ def _ip_changed(self, name, old, new):
|
338 | 338 | keyfile = Unicode(u'', config=True,
|
339 | 339 | help="""The full path to a private key file for usage with SSL/TLS."""
|
340 | 340 | )
|
| 341 | + |
| 342 | + cookie_secret = Bytes(b'', config=True, |
| 343 | + help="""The random bytes used to secure cookies. |
| 344 | + By default this is a new random number every time you start the Notebook. |
| 345 | + Set it to a value in a config file to enable logins to persist across server sessions. |
| 346 | + """ |
| 347 | + ) |
| 348 | + def _cookie_secret_default(self): |
| 349 | + return os.urandom(1024) |
341 | 350 |
|
342 | 351 | password = Unicode(u'', config=True,
|
343 | 352 | help="""Hashed password to use for web authentication.
|
|
0 commit comments