summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorHans Hörberg <hans.horberg@umu.se>2015-11-19 10:48:35 +0100
committerHans Hörberg <hans.horberg@umu.se>2015-11-19 10:48:35 +0100
commit4935c66941a0aaed3ad3b4577e4a046910bcbd7d (patch)
tree5a6f44eec093e3a1a555f8df6b5a74ff88e84c41 /example
parent361b29f4641c2e75d7a522990e0e5789e488c3c0 (diff)
parent2ce425c84ceb2f37e8cf9f2eb383abdbc1a2f087 (diff)
downloadpysaml2-4935c66941a0aaed3ad3b4577e4a046910bcbd7d.tar.gz
Merge remote-tracking branch 'upstream/master'
# Conflicts: # setup.py # src/saml2/server.py
Diffstat (limited to 'example')
-rwxr-xr-xexample/idp2/idp.py17
-rw-r--r--example/idp2/idp_user.py2
-rwxr-xr-xexample/sp-wsgi/sp.py15
3 files changed, 24 insertions, 10 deletions
diff --git a/example/idp2/idp.py b/example/idp2/idp.py
index b86e2990..74718563 100755
--- a/example/idp2/idp.py
+++ b/example/idp2/idp.py
@@ -143,16 +143,19 @@ class Service(object):
return resp(self.environ, self.start_response)
else:
kwargs = {}
+
try:
- _encrypt_cert = encrypt_cert_from_item(
+ kwargs['encrypt_cert'] = encrypt_cert_from_item(
saml_msg["req_info"].message)
- return self.do(saml_msg["SAMLRequest"], binding,
- saml_msg["RelayState"],
- encrypt_cert=_encrypt_cert, **kwargs)
except KeyError:
- # Can live with no relay state
- return self.do(saml_msg["SAMLRequest"], binding,
- saml_msg["RelayState"], **kwargs)
+ pass
+
+ try:
+ kwargs['relay_state'] = saml_msg['RelayState']
+ except KeyError:
+ pass
+
+ return self.do(saml_msg["SAMLRequest"], binding, **kwargs)
def artifact_operation(self, saml_msg):
if not saml_msg:
diff --git a/example/idp2/idp_user.py b/example/idp2/idp_user.py
index a4032aa6..71e9bf96 100644
--- a/example/idp2/idp_user.py
+++ b/example/idp2/idp_user.py
@@ -68,7 +68,7 @@ USERS = {
"ou": "IT",
"initials": "P",
#"schacHomeOrganization": "example.com",
- "email": "roland@example.com",
+ "mail": "roland@example.com",
"displayName": "P. Roland Hedberg",
"labeledURL": "http://www.example.com/rohe My homepage",
"norEduPersonNIN": "SE197001012222"
diff --git a/example/sp-wsgi/sp.py b/example/sp-wsgi/sp.py
index 278b108c..1792ab70 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
@@ -634,8 +635,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)
# ----------------------------------------------------------------------------