summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWichert Akkerman <wichert@wiggy.net>2011-01-19 18:41:31 +0100
committerWichert Akkerman <wichert@wiggy.net>2011-01-19 18:41:31 +0100
commit8844874b6266815738775b29d2eacd28bf6f1a52 (patch)
tree03d9e9308e0c0440ce409067b90900d6bc83b5c7
parentcbccade72ab39d6bb3fbe87e4ef6493ec60f131a (diff)
downloadpyramid-8844874b6266815738775b29d2eacd28bf6f1a52.tar.gz
pyramid-8844874b6266815738775b29d2eacd28bf6f1a52.tar.bz2
pyramid-8844874b6266815738775b29d2eacd28bf6f1a52.zip
Include tokens when reissueing a ticket.
-rw-r--r--pyramid/authentication.py2
-rw-r--r--pyramid/tests/test_authentication.py17
2 files changed, 18 insertions, 1 deletions
diff --git a/pyramid/authentication.py b/pyramid/authentication.py
index 133b8381b..bc823607e 100644
--- a/pyramid/authentication.py
+++ b/pyramid/authentication.py
@@ -413,7 +413,7 @@ class AuthTktCookieHelper(object):
if not hasattr(request, '_authtkt_reissued'):
if reissue and ( (now - timestamp) > self.reissue_time):
- headers = self.remember(request, userid, max_age=self.max_age)
+ headers = self.remember(request, userid, max_age=self.max_age, tokens=tokens)
add_global_response_headers(request, headers)
request._authtkt_reissued = True
diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py
index d3b5dd2c3..d86ed9f94 100644
--- a/pyramid/tests/test_authentication.py
+++ b/pyramid/tests/test_authentication.py
@@ -455,6 +455,23 @@ class TestAuthTktCookieHelper(unittest.TestCase):
self.assertEqual(len(response.headerlist), 3)
self.assertEqual(response.headerlist[0][0], 'Set-Cookie')
+ def test_identify_cookie_reissue_with_token(self):
+ import time
+ plugin = self._makeOne('secret', timeout=10, reissue_time=0)
+ plugin.auth_tkt = DummyAuthTktModule(tokens=('my-token',))
+ now = time.time()
+ plugin.auth_tkt.timestamp = now
+ plugin.now = now + 1
+ request = self._makeRequest({'HTTP_COOKIE':'auth_tkt=bogus'})
+ result = plugin.identify(request)
+ self.failUnless(result)
+ self.assertEqual(len(request.callbacks), 1)
+ response = DummyResponse()
+ request.callbacks[0](None, response)
+ self.assertEqual(len(response.headerlist), 3)
+ self.assertEqual(response.headerlist[0][0], 'Set-Cookie')
+ self.assertTrue('my-token' in response.headerlist[0][1])
+
def test_remember(self):
plugin = self._makeOne('secret')
request = self._makeRequest()