config for searchuser added
This commit is contained in:
parent
c720f21e1d
commit
260aa5e8f1
2 changed files with 12 additions and 2 deletions
|
@ -16,12 +16,17 @@ import ldap
|
|||
|
||||
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
|
||||
|
||||
from configparser import ConfigParser
|
||||
|
||||
config = ConfigParser()
|
||||
config.read('djangoldap.conf')
|
||||
|
||||
# LDAP config
|
||||
|
||||
# The search user
|
||||
AUTH_LDAP_BIND_DN = ""
|
||||
AUTH_LDAP_BIND_DN = config['LDAP']['SEARCHUSER']
|
||||
# The password for the search user
|
||||
AUTH_LDAP_BIND_PASSWORD = ""
|
||||
AUTH_LDAP_BIND_PASSWORD = config['LDAP']['SEARCHUSERPASSWORD']
|
||||
# Search union over two ou
|
||||
AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
|
||||
LDAPSearch("ou=users,dc=ungleich,dc=ch", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),
|
||||
|
|
5
dal/djangoldap.conf.example
Normal file
5
dal/djangoldap.conf.example
Normal file
|
@ -0,0 +1,5 @@
|
|||
[LDAP]
|
||||
|
||||
# Set up the user which can search
|
||||
SEARCHUSER = uid=search,ou=system,dc=ungleich,dc=ch
|
||||
SEARCHUSERPASSWORD = fnord
|
Loading…
Reference in a new issue