Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

SAML2 support based on PyXB

Project description

This package provides support for SAML2 based on pyxb; more precisely the saml20 bundle of pyxb.

pyxb ( generates a Python class collection for an XML schema and provides means to convert between associated Python instances and xml documents. It is used to generate and parse SAML2 messages.

The package adds support for digital signatures and SAML2 bindings and metadata management.



This package’s version has been tested with version 1.1.3 of pyxb. It may not work with other versions.

Class collections generated by pyxb tend to be very version dependent. Thus, they must usually be regenerated when the pyxb version has changed.

The current package’s version mostly uses class collections from the wssplat and saml20 bundles of pyxb. Thus, they have a good chance to be updated together with pyxb. However, the pyxb saml2 bundle lacks support for the so called SAML2 context classes. This package contains class collections generated with pyxb==1.1.3. They need to be regenerated if the pyxb version changes (and you use those classes – which is not very likely). The script in subpackage pyxb can provide glues how to regenerate them.

PyXB currently does not support installation via easy_install. You must install it manually. To avoid failure with an automated installation trial, the PyXB dependency is not declared in


The package uses pyxmlsec, the Python binding to the xmlsec library, for signature support.

Unfortunately, pyxmlsec is not well maintained. To allow it to handle the digital signatures for SAML2, you must at least patch its source with the patch you can find at If you work on an 64bit architecture, you will likely also need the patch at

Due to the necessary patching, the dependency on pyxmlsec is not declared in


pyxmlsec depends on libxml2, one of the Python bindings to the libxml2 library. This binding is provided as libxml2-python by many package systems (for operating system distributions). Thus, you may be able to install it easily for your system Python.

libxml2 is not registered with PyPI (the Python package index). Therefore, it cannot be installed automatically (and we do not declare this dependency in If you cannot use a system wide installed libxml2-python package, you find its source at Use the version which fits your Python version.


Note that signature creation and verification will fail with an obscure error message from xmlsec when xmlsec is not properly initialized. If default initialization is sufficient for you, then you can call dm.xmlsec.pyxb.util.default_init() for initialization.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dm.saml2, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size dm.saml2-1.0.1.tar.gz (466.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page