{"id":21138,"library":"django-auth-adfs","title":"django-auth-adfs","description":"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.","status":"active","version":"1.16.0","language":"python","source_language":"en","source_url":"https://github.com/snok/django-auth-adfs","tags":["django","authentication","adfs","azure-ad","sso","oauth2","openid-connect"],"install":[{"cmd":"pip install django-auth-adfs","lang":"bash","label":"default"}],"dependencies":[{"reason":"Core framework; requires >=3.2","package":"Django","optional":false},{"reason":"Token validation and JWKS handling","package":"cryptography","optional":false},{"reason":"HTTP requests to ADFS/Azure AD endpoints","package":"requests","optional":false}],"imports":[{"wrong":"from django_auth_adfs.backend import AuthenticationBackend","symbol":"AuthenticationBackend","correct":"from django_auth_adfs.backend import AuthenticationBackend"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    ...\n    'django_auth_adfs',\n    'django_auth_adfs.drf',  # optional: for DRF integration\n]\n\nAUTHENTICATION_BACKENDS = [\n    'django_auth_adfs.backend.AuthenticationBackend',\n    'django.contrib.auth.backends.ModelBackend',\n]\n\nAUTH_ADFS = {\n    \"SERVER\": \"adfs.yourorg.com\",\n    \"CLIENT_ID\": \"your-client-id\",\n    \"RELYING_PARTY_ID\": \"your-rp-id\",\n    \"AUDIENCE\": \"microsoft:identityserver:your-rp-id\",\n    \"CA_BUNDLE\": \"/etc/ssl/certs/ca-certificates.crt\",\n    \"CLAIM_MAPPING\": {\"first_name\": \"given_name\", \"last_name\": \"family_name\", \"email\": \"email\"},\n}\n\n# urls.py\nfrom django.urls import path, include\nurlpatterns = [\n    path('oauth2/', include('django_auth_adfs.urls')),\n]\n\n# Quick login: go to /oauth2/login","lang":"python","description":"Configure ADFS backend, claim mapping, and include OAuth2 URLs."},"warnings":[{"fix":"Upgrade to django-auth-adfs>=1.16.0","message":"Django 6 support added in 1.16.0; older versions (<1.16) may break on Django 6.","severity":"breaking","affected_versions":"<1.16.0"},{"fix":"Use django-auth-adfs<1.14.0 if stuck on older Django","message":"Django 3.2 and 4.0/4.1 dropped in 1.14.0; will cause import errors or compatibility issues.","severity":"breaking","affected_versions":">=1.14.0"},{"fix":"Verify the token's 'aud' claim matches AUTH_ADFS['AUDIENCE'] exactly; check claim mapping keys match token fields.","message":"AssertionError or AttributeError due to missing or malformed JWT token. Often caused by misconfigured AUDIENCE or CLAIM_MAPPING.","severity":"gotcha","affected_versions":"all"},{"fix":"Set SERVER to 'https://adfs.yourorg.com' (with https://)","message":"Redirect loop on login if SERVER setting does not include protocol (https://). The library does not automatically add https.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'-3':40 '-6.0':30 '1.16.0':26 '2':39 '3.2':29 '3.9':33 'ad':14,50 'adf':4,11,47 'approxim':38 'auth':3 'authent':7,46 'azur':13,49 'azure-ad':48 'backend':8 'cadenc':35 'connect':17,55 'current':24 'django':2,6,28,45 'django-auth-adf':1 'flow':18 'implement':15 'irregular':37 'microsoft':10 'minor':41 'oauth2':52 'oauth2/openid':16 'openid':54 'openid-connect':53 'per':43 'python':32 'releas':34 'sign':22 'sign-on':21 'singl':20 'sso':51 'support':27 'version':25,42 'year':44","created_at":"2026-04-27T16:58:17.709995+00:00","updated_at":"2026-04-27T16:58:17.709995+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpdi_znc5b/venv/lib/python3.12/site-packages/django_auth_adfs/backend.py\", line 5, in <module>\n    from django.contrib.auth.backends import ModelBackend\n  File \"/tmp/tmpdi_znc5b/venv/lib/python3.12/site-packages/"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.16.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/snok/django-auth-adfs","docs":"https://django-auth-adfs.readthedocs.io/en/latest","changelog":null,"pypi":"https://pypi.org/project/django-auth-adfs/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","web-framework","azure"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}