summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-01-19 12:54:19 -0500
committerChris McDonough <chrism@plope.com>2011-01-19 12:54:19 -0500
commit4e370eb5ea657177e2c800ca86d2f6376cc9c991 (patch)
tree72b657a42ec23864f1b89bade33bea87a16bcdc8
parentcf0c36c429e29aa8d83f63324f8730a36ca8212e (diff)
parentc28aa255d767955c5f2764ab39da124eb2f77f04 (diff)
downloadpyramid-4e370eb5ea657177e2c800ca86d2f6376cc9c991.tar.gz
pyramid-4e370eb5ea657177e2c800ca86d2f6376cc9c991.tar.bz2
pyramid-4e370eb5ea657177e2c800ca86d2f6376cc9c991.zip
Merge branch 'wichert-master'
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--pyramid/authentication.py2
-rw-r--r--pyramid/tests/test_authentication.py17
3 files changed, 20 insertions, 1 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index ce8aa75db..9828f7144 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -124,3 +124,5 @@ Contributors
- Marcin Lulek, 2011/01/02
- John Shipman, 2011/01/15
+
+- Wichert Akkerman, 2011/01/19
diff --git a/pyramid/authentication.py b/pyramid/authentication.py
index 2f446921c..1316c4fcc 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()