summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Best <best@univention.de>2020-11-09 20:25:15 +0100
committerFlorian Best <best@univention.de>2020-11-10 00:42:50 +0100
commita25103fc1f9cff95716d86925f3362f355c98ed5 (patch)
tree70fcd78a26afe7a88cc2178013891620b700036c
parent344ca995f6f6be2a91ff4dae5a129a72945776fb (diff)
downloadpysaml2-a25103fc1f9cff95716d86925f3362f355c98ed5.tar.gz
Fix #242: make sure status code is always returned in http_info dict
-rw-r--r--src/saml2/entity.py2
-rw-r--r--src/saml2/pack.py13
2 files changed, 9 insertions, 6 deletions
diff --git a/src/saml2/entity.py b/src/saml2/entity.py
index c9572aef..672ad6f7 100644
--- a/src/saml2/entity.py
+++ b/src/saml2/entity.py
@@ -241,7 +241,7 @@ class Entity(HTTPBase):
if response:
info = self.use_http_artifact(msg_str, destination, relay_state)
info["method"] = "GET"
- info["status"] = 302
+ info["status"] = 302 # TODO: should be 303 on >= HTTP/1.1
else:
info = self.use_http_artifact(msg_str, destination, relay_state)
else:
diff --git a/src/saml2/pack.py b/src/saml2/pack.py
index 090b13b4..f8fdbfcb 100644
--- a/src/saml2/pack.py
+++ b/src/saml2/pack.py
@@ -111,7 +111,7 @@ def http_form_post_message(message, location, relay_state="",
relay_state_input=relay_state_input,
action=location)
- return {"headers": [("Content-type", "text/html")], "data": response}
+ return {"headers": [("Content-type", "text/html")], "data": response, "status": 200}
def http_post_message(message, relay_state="", typ="SAMLRequest", **kwargs):
@@ -137,7 +137,8 @@ def http_post_message(message, relay_state="", typ="SAMLRequest", **kwargs):
part["RelayState"] = relay_state
return {"headers": [("Content-type", 'application/x-www-form-urlencoded')],
- "data": urlencode(part)}
+ "data": urlencode(part),
+ "status": 200}
def http_redirect_message(message, location, relay_state="", typ="SAMLRequest",
@@ -197,7 +198,7 @@ def http_redirect_message(message, location, relay_state="", typ="SAMLRequest",
headers = [('Location', str(login_url))]
body = []
- return {"headers": headers, "data": body}
+ return {"headers": headers, "data": body, "status": 303}
DUMMY_NAMESPACE = "http://example.org/"
@@ -257,12 +258,14 @@ def make_soap_enveloped_saml_thingy(thingy, header_parts=None):
def http_soap_message(message):
return {"headers": [("Content-type", "application/soap+xml")],
- "data": make_soap_enveloped_saml_thingy(message)}
+ "data": make_soap_enveloped_saml_thingy(message),
+ "status": 200}
def http_paos(message, extra=None):
return {"headers": [("Content-type", "application/soap+xml")],
- "data": make_soap_enveloped_saml_thingy(message, extra)}
+ "data": make_soap_enveloped_saml_thingy(message, extra),
+ "status": 200}
def parse_soap_enveloped_saml(text, body_class, header_class=None):