summaryrefslogtreecommitdiffstats
path: root/ipsilon/util
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-01-19 17:47:56 -0500
committerPatrick Uiterwijk <puiterwijk@redhat.com>2015-01-29 20:06:51 +0100
commit0d5c4ff5229880b6eba12a4e7e5bfbab2f415caa (patch)
tree49635c00dd383fdf385110b603662d4007266640 /ipsilon/util
parentc9ce29a7610b8b2232422623e28d35417b81fe76 (diff)
Add expiration to Idp metadata
Also regenerate it frequently, so that any change in configuration can be automatically reflected in the metadata downloaded my clients over time. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/util')
-rw-r--r--ipsilon/util/page.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py
index 0929961..d2ccb51 100644
--- a/ipsilon/util/page.py
+++ b/ipsilon/util/page.py
@@ -51,6 +51,14 @@ class Page(Log):
self.default_headers = dict()
self.auth_protect = False
+ def get_url(self):
+ return cherrypy.url(relative=False)
+
+ def instance_base_url(self):
+ url = self.get_url()
+ s = urlparse(unquote(url))
+ return '%s://%s%s' % (s.scheme, s.netloc, self.basepath)
+
def _check_referer(self, referer, url):
r = urlparse(unquote(referer))
u = urlparse(unquote(url))
@@ -82,7 +90,7 @@ class Page(Log):
if callable(op):
# Basic CSRF protection
if cherrypy.request.method != 'GET':
- url = cherrypy.url(relative=False)
+ url = self.get_url()
if 'referer' not in cherrypy.request.headers:
self._debug("Missing referer in %s request to %s"
% (cherrypy.request.method, url))