On 4/02/2010 11:14pm, David De La Harpe Golden wrote:
On 04/02/10 08:33, andreas schmid wrote:
@brad: can you show me some sample code for this?
David
I am using Peter Herndon's django-ldap-groups successfully. He has two
backends; one for Novell's eDirectory which I'm using and another for MS
Active Directory which I haven't tried.
http://pypi.python.org/pypi/django-ldap-groups/0.1.3
... and here the relevant bits of my settings.py. Peter's comments all
start on a new line while mine don't. I haven't adjusted anything here -
this is working code. The getcreds() method simply fetches userid and
password from a non-versioned file. I try and keep such stuff out of the
repository ...
ssl = True # switch between SSL and non-SSL
SEARCH_DN = 'O=pq8nw' # Organization name
# NT4_DOMAIN is used with Active Directory only, comment out for eDirectory
# NT4_DOMAIN = 'EXAMPLE'
# sAMAccountName is used with Active Directory
# Use the following for Active Directory
# SEARCH_FIELDS = ['mail','givenName','sn','sAMAccountName','memberOf','cn']
# Use the following for Novell eDirectory
# SEARCH_FIELDS = ['mail', 'givenName', 'sn', 'groupMembership', 'cn']
SEARCH_FIELDS = ['mail', 'givenName', 'sn', 'groupMembership', 'cn']
nds = credsdir + APP + '.nds' # contains credentials
cred = getcreds(nds) # returns a 2-element list
BIND_USER = 'cn=%s,%s' % (cred[0], SEARCH_DN)
BIND_PASSWORD = cred[1] # valid password too
# CERT_FILE = '' # not used if ssl == False
ldap_srv = '192.168.0.108'
ldap_port = 389
protocol = 'ldap'
if ssl:
protocol = 'ldaps'
ldap_port = 636
CERT_FILE = credsdir + 'cert_pq8nw_9a30.b64'
LDAP_URL = protocol + '://%s:%s' % (ldap_srv, ldap_port)
AUTHENTICATION_BACKENDS = (
'ldap_groups.accounts.backends.eDirectoryGroupMembershipSSLBackend',
#'ldap_groups.accounts.backends.ActiveDirectoryGroupMembershipSSLBackend',
'django.contrib.auth.backends.ModelBackend',
)
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.