SAML-Toolkits / python3-saml

MIT License
704 stars 309 forks source link

Cannot work with non-namespaced metadata xml #391

Open wrabit opened 10 months ago

wrabit commented 10 months ago

As per

OneLogin_Saml2_IdPMetadataParser.parse() targets specifically xml that has a 'md' namespace in nodes because it has a fixed xpath selector //md:EntityDescriptor

The XML that comes back from the metadata endpoint at Azure Active Directory (now known as Entra ID) is not namespaced with 'md', for example:

<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" ID="xxx" entityID="https://sts.windows.net/xxx/"> as noted here

So it returns nothing, preventing anything meaningful from happening.

I could handpick the values out of the xml and store them in my environment but having any changes from their side automatically propagate to our implementation is more desirable.

Is this recognised? Will a PR addressing this be considered?

pitbulk commented 9 months ago

@wrabit

The parse method is able to process Metadata XML with <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"

Check this test: https://github.com/SAML-Toolkits/python3-saml/blob/master/tests/src/OneLogin/saml2_tests/idp_metadata_parser_test.py#L115

That uses this metadata: https://github.com/SAML-Toolkits/python3-saml/blob/a1211a8695c855b74591a607cf589682307572a6/tests/data/metadata/idp_metadata.xml