From 839ea015f9bc8c8096107e700a42bb872e9dc0c8 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 23 Oct 2009 20:02:14 +0000 Subject: - Added ``max_age`` parameter to ``authtktauthenticationpolicy`` ZCML directive. If this value is set, it must be an integer representing the number of seconds which the auth tkt cookie will survive. Mainly, its existence allows the auth_tkt cookie to survive across browser sessions. - The ``reissue_time`` argument to the ``authtktauthenticationpolicy`` ZCML directive now actually works. When it is set to an integer value, an authticket set-cookie header is appended to the response whenever a request requires authentication and 'now' minus the authticket's timestamp is greater than ``reissue_time`` seconds. - The router now checks for a ``global_response_headers`` attribute of the request object before returning a response. If this value exists, it is presumed to be a sequence of two-tuples, representing a set of headers to append to the 'normal' response headers. This feature is internal, rather than exposed internally, because it's unclear whether it will stay around in the long term. It was added to support the ``reissue_time`` feature of the authtkt authentication policy. - The ``authtkt`` authentication policy ``remember`` method now no longer honors ``token`` or ``userdata`` keyword arguments. --- repoze/bfg/tests/test_router.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'repoze/bfg/tests/test_router.py') diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index 76b33d204..9306640b4 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -391,6 +391,27 @@ class TestRouter(unittest.TestCase): response = router(environ, start_response) self.assertEqual(start_response.status, '201 Created') + def test_call_request_has_global_response_headers(self): + from zope.interface import Interface + from zope.interface import directlyProvides + class IContext(Interface): + pass + from repoze.bfg.interfaces import IRequest + context = DummyContext() + directlyProvides(context, IContext) + self._registerTraverserFactory(context, subpath=['']) + response = DummyResponse('200 OK') + response.headerlist = [('a', 1)] + view = DummyView(response) + environ = self._makeEnviron() + environ['webob.adhoc_attrs'] = {'global_response_headers':[('b', 2)]} + self._registerView(view, '', IContext, IRequest) + router = self._makeOne() + start_response = DummyStartResponse() + response = router(environ, start_response) + self.assertEqual(start_response.status, '200 OK') + self.assertEqual(start_response.headers, [('a', 1), ('b', 2)]) + def test_call_eventsends(self): context = DummyContext() self._registerTraverserFactory(context) -- cgit v1.2.3