From 83ec7148841303516fe31e76116b70c8a5f73aab Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 16 Mar 2015 16:31:55 -0400 Subject: [PATCH] Set Cache-control on all generated pages, centralize in Endpoint See "Bindings for the OASIS Security Assertion Markup Language (SAML) V2.0" section 3.2.3.2. https://fedorahosted.org/ipsilon/ticket/7 Signed-off-by: Rob Crittenden Reviewed-by: Nathan Kinder --- ipsilon/admin/common.py | 5 ----- ipsilon/providers/openid/meta.py | 5 ----- ipsilon/rest/common.py | 5 ----- ipsilon/util/endpoint.py | 5 ++++- ipsilon/util/page.py | 1 - 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py index fd20077..b371fe9 100644 --- a/ipsilon/admin/common.py +++ b/ipsilon/admin/common.py @@ -39,11 +39,6 @@ class AdminPage(Page): def __init__(self, *args, **kwargs): super(AdminPage, self).__init__(*args, **kwargs) - self.default_headers.update({ - 'Cache-Control': 'no-cache, must-revalidate', - 'Pragma': 'no-cache', - 'Expires': 'Thu, 01 Dec 1994 16:00:00 GMT', - }) self.auth_protect = True diff --git a/ipsilon/providers/openid/meta.py b/ipsilon/providers/openid/meta.py index 440ef1e..6e66120 100644 --- a/ipsilon/providers/openid/meta.py +++ b/ipsilon/providers/openid/meta.py @@ -9,11 +9,6 @@ class MetaHandler(ProviderPageBase): def __init__(self, *args, **kwargs): super(MetaHandler, self).__init__(*args, **kwargs) - self.default_headers.update({ - 'Cache-Control': 'no-cache, must-revalidate', - 'Pragma': 'no-cache', - 'Expires': 'Thu, 01 Dec 1994 16:00:00 GMT', - }) self._template_name = None self._take_args = False diff --git a/ipsilon/rest/common.py b/ipsilon/rest/common.py index 4103e8e..7baea94 100644 --- a/ipsilon/rest/common.py +++ b/ipsilon/rest/common.py @@ -36,11 +36,6 @@ class RestPage(Endpoint): def __init__(self, *args, **kwargs): super(RestPage, self).__init__(*args, **kwargs) - self.default_headers.update({ - 'Cache-Control': 'no-cache, must-revalidate', - 'Pragma': 'no-cache', - 'Expires': 'Thu, 01 Dec 1994 16:00:00 GMT', - }) self.auth_protect = True diff --git a/ipsilon/util/endpoint.py b/ipsilon/util/endpoint.py index f6fd667..f160329 100644 --- a/ipsilon/util/endpoint.py +++ b/ipsilon/util/endpoint.py @@ -16,7 +16,10 @@ class Endpoint(Log): self._site = site self.basepath = cherrypy.config.get('base.mount', "") self.user = None - self.default_headers = dict() + self.default_headers = { + 'Cache-Control': 'no-cache, no-store, must-revalidate, private', + 'Pragma': 'no-cache', + } self.auth_protect = False def get_url(self): diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py index 7e88534..21c9e3e 100644 --- a/ipsilon/util/page.py +++ b/ipsilon/util/page.py @@ -49,7 +49,6 @@ class Page(Endpoint): self.basepath = cherrypy.config.get('base.mount', "") self.user = None self._is_form_page = form - self.default_headers = dict() self.auth_protect = False def get_url(self): -- 2.20.1