summaryrefslogtreecommitdiff
path: root/src/saml2/pack.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-07 15:25:11 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-07 15:25:11 +0100
commit003c4e92d19d32ebfcee8e50e5036f6e2e4442bc (patch)
tree3f7d8cabbf0bc438af61debd19cd6aaaf80ff3ac /src/saml2/pack.py
parent2e6f39046bff47072280932055dfef71236d69ef (diff)
downloadpysaml2-003c4e92d19d32ebfcee8e50e5036f6e2e4442bc.tar.gz
All (?) the artifact pieces in place.
Diffstat (limited to 'src/saml2/pack.py')
-rw-r--r--src/saml2/pack.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/saml2/pack.py b/src/saml2/pack.py
index e0bfc60f..6ab6e390 100644
--- a/src/saml2/pack.py
+++ b/src/saml2/pack.py
@@ -71,6 +71,7 @@ def http_form_post_message(message, location, relay_state="", typ="SAMLRequest")
_msg = base64.b64encode(message)
else:
_msg = message
+
response.append(FORM_SPEC % (location, typ, _msg, relay_state))
response.append("""<script type="text/javascript">""")
@@ -109,9 +110,14 @@ def http_redirect_message(message, location, relay_state="", typ="SAMLRequest"):
if not isinstance(message, basestring):
message = "%s" % (message,)
-
- args = {typ: deflate_and_base64_encode(message)}
-
+
+ if typ in ["SAMLRequest", "SAMLResponse"]:
+ args = {typ: deflate_and_base64_encode(message)}
+ elif typ == "SAMLart":
+ args = {typ: message}
+ else:
+ raise Exception("Unknown message type: %s" % typ)
+
if relay_state:
args["RelayState"] = relay_state