-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Metadata Namespaces #131
Comments
I"ve tried different combinations: |
I am able to get djangosaml2 to produce the namespaces that I wanted on the metadata. <md:EntityDescriptor xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://localhost:8000/saml2/metadata" validUntil="2018-09-21T22:58:21Z">
<md:Extensions>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#md5"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#ripemd160"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#sha224"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#sha384"/>
<alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2009/xmldsig11#dsa-sha256"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-md5"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha224"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"/>
</md:Extensions>
<md:SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
<!-- omitted -->
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8000/saml2/ls/"/>
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8000/saml2/ls/post"/>
<md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8000/saml2/acs/" index="1"/>
<md:AttributeConsumingService index="1">
<md:ServiceName xml:lang="en"/>
<md:RequestedAttribute FriendlyName="uid" Name="urn:oid:0.9.2342.19200300.100.1.1" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"/>
</md:AttributeConsumingService>
</md:SPSSODescriptor>
<md:Organization>
<!-- omitted -->
</md:Organization>
<md:ContactPerson contactType="technical">
<!-- omitted -->
</md:ContactPerson>
</md:EntityDescriptor> However, this still missing the To get this result, I had to add the following lines in # Add the following import on top
from saml2 import ElementTree
...
# Add the following lines at the end afer get_namespace_prefixes()
def register_namespace_prefixes():
from saml2 import md, saml, samlp
from saml2.extension import algsupport
try:
from saml2 import xmlenc
from saml2 import xmldsig
except ImportError:
import xmlenc
import xmldsig
prefixes = (('saml', saml.NAMESPACE),
('samlp', samlp.NAMESPACE),
('md', md.NAMESPACE),
('ds', xmldsig.NAMESPACE),
('xenc', xmlenc.NAMESPACE),
('alg', algsupport.NAMESPACE))
if hasattr(ElementTree, 'register_namespace'):
for prefix, namespace in prefixes:
ElementTree.register_namespace(prefix, namespace)
else:
for prefix, namespace in prefixes:
ElementTree._namespace_map[namespace] = prefix
# print("ELEMENT TREE: {}".format(ElementTree._namespace_map))
register_namespace_prefixes() The code above was from the old Bitbucket repo of djangosaml2. Was there a reason this part is removed in the Github version of djangosaml2? |
This would be automatically fixed when this PR will be merged in pySAML2 standing about what @c00kiemon5ter said it wouldnt take too much time |
I don't really know when pySAML2 dev team will merge that contribution but it's time to close this issue, because not strictly related to djangosaml2. Please continue this thread in pySAML2 repository, I'm also there |
I cannot produce the sp metadata with the correct namespaces. I'm expecting the correct namespaces on the tags (like in sp_metadata.xml), but my metadata gives
<ns#:...>
. I'm looking for help. Any ideas?I'm using
python==3.6.5
,django==1.11
,djangosaml2==0.17.2
,pysaml2==4.6.2
This is the metadata I got from
localhost:8000/saml2/metadata/
:This is my djangosaml2 settings (added to the end of the
settings.py
file)The text was updated successfully, but these errors were encountered: