Registry / auth-security / django-auth-adfs

django-auth-adfs

JSON →
library1.16.0pypypiunverified

A Django authentication backend for Microsoft ADFS and Azure AD. Implements OAuth2/OpenID Connect flows for single sign-on. Current version 1.16.0 supports Django 3.2-6.0 and Python 3.9+. Release cadence is irregular, approximately 2-3 minor versions per year.

pip install django-auth-adfs
INSTALL
IMPORT
SIG · DJANGO-AUTH-ADFS
D
django-auth-adfs
auth-securitypythonv1.16.0
Install
4.8s avg
Import
Disk
86MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 86.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.8s · import 0.000s · 87MB
86MB installed
● package 86MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthenticationBackend
from django_auth_adfs.backend import AuthenticationBackend
from django_auth_adfs.backend import AuthenticationBackend

Configure ADFS backend, claim mapping, and include OAuth2 URLs.

# settings.py INSTALLED_APPS = [ ... 'django_auth_adfs', 'django_auth_adfs.drf', # optional: for DRF integration ] AUTHENTICATION_BACKENDS = [ 'django_auth_adfs.backend.AuthenticationBackend', 'django.contrib.auth.backends.ModelBackend', ] AUTH_ADFS = { "SERVER": "adfs.yourorg.com", "CLIENT_ID": "your-client-id", "RELYING_PARTY_ID": "your-rp-id", "AUDIENCE": "microsoft:identityserver:your-rp-id", "CA_BUNDLE": "/etc/ssl/certs/ca-certificates.crt", "CLAIM_MAPPING": {"first_name": "given_name", "last_name": "family_name", "email": "email"}, } # urls.py from django.urls import path, include urlpatterns = [ path('oauth2/', include('django_auth_adfs.urls')), ] # Quick login: go to /oauth2/login
Debug
Known issues
breakingDjango 6 support added in 1.16.0; older versions (<1.16) may break on Django 6.
fix
Upgrade to django-auth-adfs>=1.16.0
affects: <1.16.0
breakingDjango 3.2 and 4.0/4.1 dropped in 1.14.0; will cause import errors or compatibility issues.
fix
Use django-auth-adfs<1.14.0 if stuck on older Django
affects: >=1.14.0
gotchaAssertionError or AttributeError due to missing or malformed JWT token. Often caused by misconfigured AUDIENCE or CLAIM_MAPPING.
fix
Verify the token's 'aud' claim matches AUTH_ADFS['AUDIENCE'] exactly; check claim mapping keys match token fields.
affects: all
gotchaRedirect loop on login if SERVER setting does not include protocol (https://). The library does not automatically add https.
fix
Set SERVER to 'https://adfs.yourorg.com' (with https://)
affects: all
Upgrade
Version history
1.16.0latest on PyPI · released Jan 8, 2026
Audit
Dependencies
DjangorequiredCore framework; requires >=3.2
cryptographyrequiredToken validation and JWKS handling
requestsrequiredHTTP requests to ADFS/Azure AD endpoints
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
django-auth-adfs — pip install django-auth-adfs · libregistry