skillfed

django-auth-adfs

A Django authentication backend for Microsoft ADFS and AzureAD

django-auth-adfs v1.16.0 147.8K downloads/30d#11,052 on PyPI299
Permissive license BSD-1-Clause Active released

What it is and what it does

django-auth-adfs is a Django authentication backend that delegates user login to Microsoft ADFS (Active Directory Federation Services) or Azure AD. Instead of storing passwords in Django, it redirects users through an OAuth2 flow to your organization's identity provider, then creates or updates Django user accounts based on claims returned from ADFS. It handles the full redirect cycle—login initiation, ADFS callback, token validation via cryptography and PyJWT, and automatic group assignment—so developers can focus on application logic rather than directory integration.

The package is designed for intranet and cloud environments where centralized identity management is already in place. It depends on django, requests, urllib3, cryptography, and PyJWT to manage HTTP communication, certificate validation, and token verification. Configuration is done through Django settings, and it provides optional middleware to enforce login across your application and template tags for login/logout links.

Use it for:

  • Enterprise Django applications where users authenticate via corporate Active Directory or Azure AD without storing passwords in the app.
  • Intranet portals that need single sign-on (SSO) so employees log in once to ADFS and automatically gain access to Django apps.
  • Multi-tenant SaaS platforms using Azure AD for customer organization authentication and automatic user provisioning.
  • Django REST Framework APIs that accept ADFS access tokens for stateless, federated authentication.
  • Organizations migrating from on-premises ADFS to Azure AD while keeping existing Django applications.

Worth the install?

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

Integrates Django applications with Microsoft ADFS and Azure AD for single sign-on authentication, automatically provisioning users and group memberships from directory claims.

Yes, if you are building a Django application in an organization using ADFS or Azure AD for identity management. The package is production-stable, actively maintained, has no known vulnerabilities, and handles the complex OAuth2 and token validation logic so you don't have to. Install it only if your deployment environment has an ADFS or Azure AD endpoint already configured; it is not useful for standalone Django apps or those using other identity providers.

Install

django-auth-adfs on PyPI

pip

pip install django-auth-adfs

uv

uv add django-auth-adfs

poetry

poetry add django-auth-adfs

Installing django-auth-adfs

Before you install

Low install friction with a pure-Python wheel distribution. Actively maintained as of 2026-01-08 with recent commits, and supports current Django versions (4.2 through 6.0) and Python 3.9–3.14.

License in practice

BSD-1-Clause is a permissive open-source license with minimal restrictions on use, modification, and distribution in both commercial and private projects.

Quickstart

pip install django-auth-adfs

# In settings.py:
AUTHENTICATION_BACKENDS = ('django_auth_adfs.backend.AdfsAuthCodeBackend',)
INSTALLED_APPS = (..., 'django_auth_adfs')
AUTH_ADFS = {
    'SERVER': 'adfs.yourcompany.com',
    'CLIENT_ID': 'your-client-id',
    'RELYING_PARTY_ID': 'your-rpt-name',
}

# In urls.py:
path('oauth2/', include('django_auth_adfs.urls'))

Requires ADFS or Azure AD server endpoint configured with a client ID and relying party trust; certificate bundle path may be needed for on-premises ADFS.

Verify before relying

  • Whether the package works with Django versions beyond 6.0 or Python 3.14 in production (classifiers list them but latest release is 2026-01-08).
  • Performance characteristics when handling large numbers of concurrent ADFS authentication requests.
  • Compatibility with non-standard ADFS claim mappings or custom identity providers.

Package facts

License BSD-1-Clause (permissive)
Python support supports the current Python release (<4.0,>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 5 — django, requests, urllib3, cryptography, PyJWT
Maintenance actively maintained — 218 days since the last release
Last repo commit
First released
Downloads 147,754/month — #11,052 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_auth_adfs-1.16.0-py3-none-any.whl

Keywords: django, authentication, adfs, azure, ad, oauth2

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI ApprovedLicense :: OSI Approved :: BSD 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.14Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: WSGITopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules

Tags

django adfs authenticationazure ad django loginactive directory django ssodjango oauth2 adfsmicrosoft adfs django backend
authenticationenterprise-identitysso

More Python Modules packages