Installation:
-
Place this File into lib/
or anywhere else
-
In settings.py:
AUTHENTICATION_BACKENDS = [
'lib.Ldap3AuthBackend.Ldap3AuthBackend',
# ^------------- or anywhere else
'django.contrib.auth.backends.ModelBackend',
# '...',
]
- It tries to bind and whoami to <LDAP_HOST> with given Credentials
- It searches in <LDAP_GROUPS> for groupOfName members
- It checks if user is in one of these members lists
- It syncs the groups to Database
- It assigns the appropriate group(s) to user
If no user exists in db - it will be created
A Configfile just as
{
"ldap-auth": {
"host": "...",
"port": 389,
"base_dn": "...",
"users_basedn": "...",
"groups_dn": "..."
}
}
LDAP_AUTH_HOST = '...'
LDAP_AUTH_GROUP_DN = '...'
LDAP_AUTH_USER_BASEDN = '...'
LDAP_AUTH_PORT = 389
export LDAP_AUTH_HOST='...'
export LDAP_AUTH_GROUP_DN='...'
export LDAP_AUTH_USER_BASEDN='...'
export LDAP_AUTH_PORT=389
or sourced from somewhere