LDAP login. README

This commit is contained in:
nikolark committed 2011-10-08 16:16:09 +02:00
1 parent 4ee0e7dddf
commit ec6a6cc922
2 files changed
+48 -2

No files matched your search

+44 -2
View File
@@ -16,7 +16,7 @@ DATABASES = {
'NAME': 'snurr', # Or path to database file if using sqlite3.
'USER': 'snurr', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'HOST': 'snes.neuf.no', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
@@ -32,7 +32,7 @@ TIME_ZONE = 'Europe/Oslo'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'no-nb'
SITE_ID = 1
@@ -117,6 +117,48 @@ INSTALLED_APPS = (
'django.contrib.admin',
'main',
)
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
# LDAP server URI and BIND_DN
AUTH_LDAP_SERVER_URI = 'ldap://pacman.neuf.no'
AUTH_LDAP_BIND_DN = 'uid=admin,ou=People,dc=neuf,dc=no'
AUTH_LDAP_BIND_PASSWORD = ''
import ldap
from django_auth_ldap.config import LDAPSearch, PosixGroupType
# basic user auth
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=People,dc=neuf,dc=no",
ldap.SCOPE_ONELEVEL, "(uid=%(user)s)")
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,dc=neuf,dc=no"
# groups
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Groups,dc=neuf,dc=no",
ldap.SCOPE_ONELEVEL, "(objectClass=posixGroup)"
)
AUTH_LDAP_GROUP_TYPE = PosixGroupType()
# Mirror groups on each auth
AUTH_LDAP_MIRROR_GROUPS = True
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": "cn=dns-alle,ou=Groups,dc=neuf,dc=no",
"is_staff": "cn=edb,ou=Groups,dc=neuf,dc=no",
"is_superuser": "cn=edbadmin,ou=Groups,dc=neuf,dc=no"
}
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
}
# Allways update the django user object on authentication.
AUTH_LDAP_ALWAYS_UPDATE_USER = True
import logging
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to