Skip to content

Commit 984332d

Browse files
committed
Documentation and test for cookie domain
1 parent bd2922b commit 984332d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/options.rst

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ These are only applicable if ``JWT_TOKEN_LOCATION`` is set to use cookies.
6060
``JWT_COOKIE_SECURE`` If the secure flag should be set on your JWT cookies. This will only allow
6161
the cookies to be sent over https. Defaults to ``False``, but in production
6262
this should likely be set to ``True``.
63+
``JWT_COOKIE_DOMAIN`` Value to use for a cross domain cookies. Defaults to ``None`` which sets
64+
this cookie to only be readable by the domain that set it.
6365
``JWT_SESSION_COOKIE`` If the cookies should be session cookies (deleted when the
6466
browser is closed) or persistent cookies (never expire).
6567
Defaults to ``True`` (session cookies).

tests/test_config.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_default_configs(self):
2929
self.assertEqual(config.access_cookie_path, '/')
3030
self.assertEqual(config.refresh_cookie_path, '/')
3131
self.assertEqual(config.cookie_secure, False)
32+
self.assertEqual(config.cookie_domain, None)
3233
self.assertEqual(config.session_cookie, True)
3334

3435
self.assertEqual(config.csrf_protect, False)
@@ -66,6 +67,7 @@ def test_override_configs(self):
6667
self.app.config['JWT_ACCESS_COOKIE_PATH'] = '/access/path'
6768
self.app.config['JWT_REFRESH_COOKIE_PATH'] = '/refresh/path'
6869
self.app.config['JWT_COOKIE_SECURE'] = True
70+
self.app.config['JWT_COOKIE_DOMAIN'] = ".example.com"
6971
self.app.config['JWT_SESSION_COOKIE'] = False
7072

7173
self.app.config['JWT_COOKIE_CSRF_PROTECT'] = True
@@ -100,6 +102,7 @@ def test_override_configs(self):
100102
self.assertEqual(config.access_cookie_path, '/access/path')
101103
self.assertEqual(config.refresh_cookie_path, '/refresh/path')
102104
self.assertEqual(config.cookie_secure, True)
105+
self.assertEqual(config.cookie_domain, ".example.com")
103106
self.assertEqual(config.session_cookie, False)
104107

105108
self.assertEqual(config.csrf_protect, True)

0 commit comments

Comments
 (0)