skillfed

djangosaml2idp2

SAML 2.0 Identity Provider for Django

djangosaml2idp2 v0.9.1 84.0K downloads/30d#14,037 on PyPI0
Permissive license Apache Software License 2.0 Active released

What it is and what it does

djangosaml2idp2 is a Django application that implements the Identity Provider (IdP) side of the SAML 2.0 protocol, enabling your Django application to act as a federated authentication server. It builds on PySAML2 and handles the cryptographic signing and encryption of SAML assertions, metadata generation, and single sign-on flows. You configure it by adding it to Django's installed apps, including its URL routes, and then defining your IdP configuration (certificates, endpoints, signing algorithms) and registering Service Providers through the Django admin interface.

The package is production-ready and supports modern Django versions and Python 3.9 and later. It requires the xmlsec binary to be installed separately on your system for SAML assertion signing. Configuration is done via Django settings and the admin interface, with hooks for custom access control logic via processor classes and customizable attribute mapping between Django user fields and SAML assertions.

Use it for:

  • Build a corporate SSO server where multiple web applications authenticate users against a central Django-based IdP.
  • Integrate Django with federated identity systems by acting as an IdP for SAML 2.0 service providers.
  • Implement custom access control logic per service provider using processor subclasses to enforce fine-grained authentication rules.
  • Map Django user attributes to SAML fields for seamless user provisioning across federated applications.
  • Support multiple authentication algorithms and encryption standards by configuring signing and digest algorithms per service provider.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements the SAML 2.0 Identity Provider side for Django applications, enabling federated authentication and single sign-on (SSO) by building on PySAML2.

Yes. This is a production-ready, actively maintained SAML 2.0 IdP implementation for Django with low install friction, permissive licensing, no known vulnerabilities, and support for current Django and Python versions. Install it if you need to operate a federated authentication server. The main prerequisite is having xmlsec available on your system.

Install

djangosaml2idp2 on PyPI

pip

pip install djangosaml2idp2

uv

uv add djangosaml2idp2

poetry

poetry add djangosaml2idp2

Installing djangosaml2idp2

Before you install

Low install friction with a pure-Python wheel distribution. Active maintenance with recent commits and support for current Django versions (4.2, 5.1, 5.2) and Python 3.9–3.13. Requires xmlsec binary (XML Security Library) to be installed separately on the system for SAML assertion signing.

License in practice

Licensed under Apache Software License 2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for production deployments.

Quickstart

pip install djangosaml2idp2

# In Django settings.py:
INSTALLED_APPS = [
    'djangosaml2idp',
    ...
]

# In urls.py:
urlpatterns = [
    path('idp/', include('djangosaml2idp.urls')),
]

# Configure SAML_IDP_CONFIG with xmlsec_binary path, certificates, and service endpoints.

Requires xmlsec binary (XML Security Library) to be installed on the system; the package will not function for signing SAML assertions without it.

Verify before relying

  • Whether the fork actively maintains compatibility with the original OTA-Insight/djangosaml2idp or diverges significantly.
  • Performance characteristics under high-volume SSO traffic or with many service providers configured.
  • Completeness of documentation and examples beyond the excerpt provided.

Package facts

License Apache Software License 2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 4 — django, pysaml2, pytz, arrow
Maintenance actively maintained — 158 days since the last release
Last repo commit
First released
Downloads 83,976/month — #14,037 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: djangosaml2idp2-0.9.1-py2.py3-none-any.whl

Keywords: django, pysaml2, sso, saml2, federated authentication, authentication, idp

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: WSGITopic :: SecurityTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules

Tags

saml2 identity provider djangosso federated authenticationdjango saml idpsaml2 service provider integrationdjango authentication federation
saml2-idpfederated-authsso

More Python Modules packages