def unravel(self, txt, binding, msgtype="response"): #logger.debug("unravel '%s'" % txt) if binding not in [ BINDING_HTTP_REDIRECT, BINDING_HTTP_POST, BINDING_SOAP, BINDING_URI, BINDING_HTTP_ARTIFACT, None ]: raise ValueError("Don't know how to handle '%s'" % binding) else: try: if binding == BINDING_HTTP_REDIRECT: xmlstr = decode_base64_and_inflate(txt) elif binding == BINDING_HTTP_POST: xmlstr = base64.b64decode(txt) elif binding == BINDING_SOAP: func = getattr(soap, "parse_soap_enveloped_saml_%s" % msgtype) xmlstr = func(txt) elif binding == BINDING_HTTP_ARTIFACT: xmlstr = base64.b64decode(txt) else: xmlstr = txt except Exception: raise UnravelError() return xmlstr
def unravel(txt, binding, msgtype="response"): """ Will unpack the received text. Depending on the context the original response may have been transformed before transmission. :param txt: :param binding: :param msgtype: :return: """ #logger.debug("unravel '%s'" % txt) if binding not in [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST, BINDING_SOAP, BINDING_URI, BINDING_HTTP_ARTIFACT, None]: raise ValueError("Don't know how to handle '%s'" % binding) else: try: if binding == BINDING_HTTP_REDIRECT: xmlstr = decode_base64_and_inflate(txt) elif binding == BINDING_HTTP_POST: xmlstr = base64.b64decode(txt) elif binding == BINDING_SOAP: func = getattr(soap, "parse_soap_enveloped_saml_%s" % msgtype) xmlstr = func(txt) elif binding == BINDING_HTTP_ARTIFACT: xmlstr = base64.b64decode(txt) else: xmlstr = txt except Exception: raise UnravelError() return xmlstr
def unravel(txt, binding, msgtype="response"): """ Will unpack the received text. Depending on the context the original response may have been transformed before transmission. :param txt: :param binding: :param msgtype: :return: """ if binding not in [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST, None]: raise UnknownBinding("Don't know how to handle '%s'" % binding) else: try: if binding == BINDING_HTTP_REDIRECT: xmlstr = decode_base64_and_inflate(txt) elif binding == BINDING_HTTP_POST: xmlstr = base64.b64decode(txt) else: xmlstr = txt except Exception: raise UnravelError("Unravelling binding '%s' failed" % binding) return xmlstr