Microsoft Entra ID Authentication for Django¶
A Django authentication backend for Microsoft Entra ID (formerly Azure AD)
Free software: BSD License
Documentation: http://django-entra-auth.readthedocs.io/
Important
This project is derived from the excellent work by Joris Beckers and contributors on django-auth-adfs. We maintain the same BSD license and have adapted their codebase for Microsoft Entra ID-specific functionality. Many thanks to the original authors for their contributions to the Django authentication ecosystem.
Features¶
Integrates Django with Microsoft Entra ID in the cloud
Provides seamless single sign on (SSO) for your Django project
Auto creates users and adds them to Django groups based on info received from Entra ID
Django Rest Framework (DRF) integration: Authenticate against your API with an Entra ID access token
Note
While this library fully supports Microsoft Entra ID (formerly Azure AD), you’ll notice that many class names
in the code still use “Adfs” prefix (e.g., AdfsBaseBackend
, AdfsAuthCodeBackend
). This naming is
historical and maintained for backward compatibility. The library works with Microsoft Entra ID regardless of
these class names.
Contents¶
- Installation
- OpenID Connect with Microsoft Entra ID
- Settings Reference
- AUDIENCE
- BLOCK_GUEST_USERS
- BOOLEAN_CLAIM_MAPPING
- CA_BUNDLE
- CLAIM_MAPPING
- CLIENT_ID
- CLIENT_SECRET
- CONFIG_RELOAD_INTERVAL
- CREATE_NEW_USERS
- DISABLE_SSO
- GROUPS_CLAIM
- JWT_LEEWAY
- GROUP_TO_FLAG_MAPPING
- GUEST_USERNAME_CLAIM
- LOGIN_EXEMPT_URLS
- MIRROR_GROUPS
- RETRIES
- SCOPES
- SETTINGS_CLASS
- TENANT_ID
- TIMEOUT
- USERNAME_CLAIM
- VERSION
- PROXIES
- TOKEN_REFRESH_THRESHOLD
- STORE_OBO_TOKEN
- TOKEN_ENCRYPTION_SALT
- LOGOUT_ON_TOKEN_REFRESH_FAILURE
- Configuration Guides
- Middleware
- Token Lifecycle Middleware
- Django Signals
- Rest Framework Integration
- Demo
- Troubleshooting
- Frequently Asked Questions
- Why am I always redirected to
/accounts/profile/
after login? - How do I store additional info about a user?
- I’m receiving a
KeyError: 'upn'
error when authenticating. - Why is a user added and removed from the same group on every login?
- The redirect_uri starts with HTTP, while my site is HTTPS only.
- I cannot get it working!
- What is the relationship between django-entra-auth and django-auth-adfs?
- Why am I always redirected to
- Contributing
- Credits