From 8844874b6266815738775b29d2eacd28bf6f1a52 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Wed, 19 Jan 2011 18:41:31 +0100 Subject: Include tokens when reissueing a ticket. --- pyramid/authentication.py | 2 +- pyramid/tests/test_authentication.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3 From f47d110b758cedff324c3f6605515fe416a23cd0 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Wed, 19 Jan 2011 18:49:59 +0100 Subject: Add myself to the contributors. --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit v1.2.3