summaryrefslogtreecommitdiff
path: root/src/saml2/request.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2012-12-29 17:44:03 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2012-12-29 17:44:03 +0100
commit4dcd3cf2707a992a8e0fdc83ac4d9ef3d599765d (patch)
tree664002127761b34bc47e185deb7d408b7d8ebe9f /src/saml2/request.py
parenta26772f63774b05e5b810da1e92f847d18fd9f6f (diff)
downloadpysaml2-4dcd3cf2707a992a8e0fdc83ac4d9ef3d599765d.tar.gz
Request preparation refactoring
Diffstat (limited to 'src/saml2/request.py')
-rw-r--r--src/saml2/request.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/saml2/request.py b/src/saml2/request.py
index adf821bc..26278966 100644
--- a/src/saml2/request.py
+++ b/src/saml2/request.py
@@ -1,7 +1,8 @@
+import base64
import logging
from attribute_converter import to_local
-from saml2 import time_util
+from saml2 import time_util, BINDING_HTTP_REDIRECT, BINDING_HTTP_POST
from saml2 import s_utils
from saml2.s_utils import OtherError
@@ -32,10 +33,12 @@ class Request(object):
self.message = None
self.not_on_or_after = 0
- def _loads(self, xmldata, decode=True):
- if decode:
+ def _loads(self, xmldata, binding):
+ if binding == BINDING_HTTP_REDIRECT:
logger.debug("Expected to decode and inflate xml data")
decoded_xml = s_utils.decode_base64_and_inflate(xmldata)
+ elif binding == BINDING_HTTP_POST:
+ decoded_xml = base64.b64decode(xmldata)
else:
decoded_xml = xmldata
@@ -86,8 +89,8 @@ class Request(object):
assert self.issue_instant_ok()
return self
- def loads(self, xmldata, decode=True):
- return self._loads(xmldata, decode)
+ def loads(self, xmldata, binding):
+ return self._loads(xmldata, binding)
def verify(self):
try: