diff options
author | Simo Sorce <simo@redhat.com> | 2015-01-19 17:47:56 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-01-29 10:58:06 -0500 |
commit | a03df64ecc7f23ca9a78839fbcf243e23c10f840 (patch) | |
tree | 49635c00dd383fdf385110b603662d4007266640 /ipsilon/util/page.py | |
parent | 963a764f9c310d8cf068dbec7f8dfe8ee666abaa (diff) | |
download | ipsilon-ticket-8.tar.gz ipsilon-ticket-8.tar.xz ipsilon-ticket-8.zip |
Add expiration to Idp metadataticket-8
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>
Diffstat (limited to 'ipsilon/util/page.py')
-rw-r--r-- | ipsilon/util/page.py | 10 |
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)) |