summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2015-11-15 10:12:32 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2015-11-15 10:12:32 +0100
commitad8e8cb1eefdc8d90f4d53851634ce08b5bca9a8 (patch)
treea6f942c9e5769ecab1c6b56060b90d5ed8e7b1c0 /example
parent3c38cef9346ec787c360e888898baddbbd03c737 (diff)
downloadpysaml2-ad8e8cb1eefdc8d90f4d53851634ce08b5bca9a8.tar.gz
Check for logout
Diffstat (limited to 'example')
-rwxr-xr-xexample/sp-wsgi/sp.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/example/sp-wsgi/sp.py b/example/sp-wsgi/sp.py
index 014df3ae..3fbd0bd9 100755
--- a/example/sp-wsgi/sp.py
+++ b/example/sp-wsgi/sp.py
@@ -38,6 +38,7 @@ from saml2.httputil import NotImplemented
from saml2.response import StatusError
from saml2.response import VerificationError
from saml2.s_utils import UnknownPrincipal
+from saml2.s_utils import decode_base64_and_inflate
from saml2.s_utils import UnsupportedBinding
from saml2.s_utils import sid
from saml2.s_utils import rndstr
@@ -633,8 +634,18 @@ class SLO(Service):
self.sp = sp
self.cache = cache
- def do(self, response, binding, relay_state="", mtype="response"):
- req_info = self.sp.parse_logout_request_response(response, binding)
+ def do(self, message, binding, relay_state="", mtype="response"):
+ try:
+ txt = decode_base64_and_inflate(message)
+ is_logout_request = 'LogoutRequest' in txt.split('>', 1)[0]
+ except: # TODO: parse the XML correctly
+ is_logout_request = False
+
+ if is_logout_request:
+ self.sp.parse_logout_request(message, binding)
+ else:
+ self.sp.parse_logout_request_response(message, binding)
+
return finish_logout(self.environ, self.start_response)
# ----------------------------------------------------------------------------