Django Azure AD Auth allows you to authenticate through Azure Active Directory.
This fork has the following additional features:
- cache-based nonce retaining in addition to the existing cookie-based ones to allow organizational redirect logins to work.
- static group mapping option.
- the possibility of changing the upn default value.
Run pip install django-azure-ad-auth
Add the AzureActiveDirectoryBackend
to your AUTHENTICATION_BACKENDS
setting:
AUTHENTICATION_BACKENDS = (
...
'azure_ad_auth.backends.AzureActiveDirectoryBackend',
)
The Azure Tenant ID. It can be found in the URL of the Azure Management Portal.
The Azure Application Client ID.
default: 'https://login.microsoftonline.com'
The domain that is used for authorization, the federation metadata document, and loggin out.
default: 'openid'
OAuth scope parameter.
default: 'id_token'
Tells OAuth to return a JWT token in its response.
default: 'form_post'
Defines how the response parameters are returned. Valid choices are fragment
or form_post
.
default: True
Allow creation of new users after successful authentication.
default: upn
Select the unique field to be used for user creation.
default: {}
Map fields from the token to the user, to be used on creation.
default: {}
Map static values to user fields on creation.
default: {}
Map group ids to group names for user permissions.
default: set()
Map static groups to user.