Skip to content

Commit

Permalink
Merge branch 'wichert-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Jan 19, 2011
2 parents cf0c36c + c28aa25 commit 4e370eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,5 @@ Contributors
- Marcin Lulek, 2011/01/02

- John Shipman, 2011/01/15

- Wichert Akkerman, 2011/01/19
2 changes: 1 addition & 1 deletion pyramid/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def identify(self, request):

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

Expand Down
17 changes: 17 additions & 0 deletions pyramid/tests/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,23 @@ def test_identify_cookie_reissue(self):
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()
Expand Down

0 comments on commit 4e370eb

Please sign in to comment.