summaryrefslogtreecommitdiff
path: root/src/saml2/httputil.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-22 12:19:12 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-22 12:19:12 +0100
commit97ecbd509b610be573752b2707d2df007efc2f24 (patch)
tree06a5e84ddcf0f9a0f3d90898a0d00428d6ed09cb /src/saml2/httputil.py
parentc35362abdcaf7bd6f854ba6b07f5ae1caaa7d204 (diff)
downloadpysaml2-97ecbd509b610be573752b2707d2df007efc2f24.tar.gz
Updated to follow the new API.
Fixed a cert in metadata handling problem
Diffstat (limited to 'src/saml2/httputil.py')
-rw-r--r--src/saml2/httputil.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/saml2/httputil.py b/src/saml2/httputil.py
index e372225b..2d38756e 100644
--- a/src/saml2/httputil.py
+++ b/src/saml2/httputil.py
@@ -1,4 +1,9 @@
import logging
+from saml2 import BINDING_HTTP_ARTIFACT
+from saml2 import BINDING_HTTP_REDIRECT
+from saml2 import BINDING_HTTP_POST
+from saml2 import BINDING_URI
+from saml2 import BINDING_SOAP
__author__ = 'rohe0002'
@@ -186,3 +191,29 @@ def unpack_artifact(environ):
else:
_dict = None
return _dict
+
+def unpack_any(environ):
+ binding = ""
+ if environ['REQUEST_METHOD'].upper() == 'GET':
+ # Could be either redirect or artifact
+ _dict = unpack_redirect(environ)
+ if "ID" in _dict:
+ binding = BINDING_URI
+ elif "SAMLart" in _dict:
+ binding = BINDING_HTTP_ARTIFACT
+ else:
+ binding = BINDING_HTTP_REDIRECT
+ else:
+ content_type = environ.get('CONTENT_TYPE', 'application/soap+xml')
+ if content_type != 'application/soap+xml':
+ # normal post
+ _dict = unpack_post(environ)
+ if "SAMLart" in _dict:
+ binding = BINDING_HTTP_ARTIFACT
+ else:
+ binding = BINDING_HTTP_POST
+ else:
+ _dict = unpack_soap(environ)
+ binding = BINDING_SOAP
+
+ return _dict, binding \ No newline at end of file