pysaml2 icon indicating copy to clipboard operation
pysaml2 copied to clipboard

namespace aliases somehow do not work

Open grindhold opened this issue 3 years ago • 0 comments

I load a custom XSD-file for a schema extension. It has a namespace long namespace assigned, however in the saml-messages this long namespace is not used in the tags, instead, they just are like <q1:TagName>. I resolved this by patching override_lookup_type and override_lookup_element like this:

orig_lookup_element = xmlschema.validators.global_maps.XsdGlobals.lookup_element
def override_lookup_element(self, qname):
    if qname.startswith("q1:"):
        qname = qname.replace("q1:", "{urn:foo:long:namespace}",1)
    return orig_lookup_element(self, qname)
xmlschema.validators.global_maps.XsdGlobals.lookup_element = override_lookup_element

This seems very wrong to me. Is there another way to tell the thing that "q1" is an alias for the long namespace?

grindhold avatar Aug 30 '22 08:08 grindhold