On Jun 17, 10:02 am, Johann Spies <johann.sp...@gmail.com> wrote: > I am trying to figure out how to use ldap-authentication. Although the > change-log for the latest web2py indicates improved ldap-functionality > I could not find clear documentation on how to use it.
Best docs is the source itself: gluon/contrib/login_methods/ldap_auth.py > auth=Auth(globals(),db) > from gluon.contrib.login_methods.ldap_auth import ldap_auth > auth.settings.login_methods.append(ldap_auth("ldaps://stbldap01.sun.ac.za > stbldap02.sun.ac.za/ou=users,O=SU?cn")) What kind of LDAP server is it? If using OpenLDAP you want: auth.settings.login_methods.append(ldap_auth (server='stbldap01.sun.ac.za', base_dn='ou=users,O=SU') If using Active Directory you want: auth.settings.login_methods.append(ldap_auth(mode='ad', server='stbldap01.sun.ac.za', base_dn='ou=users,O=SU') If using Domino you want: auth.settings.login_methods.append(ldap_auth(mode='domino', server='stbldap01.sun.ac.za') Anything else is currently untested. ldaps:// support isn't yet available, but is easy to patch into it. Is a simple 'secure=True' passing a good enough syntax? The OpenLDAP assumes that we're searching on uid. However you seem to want to search on cn. If you provide the working command line bind using one of the ldap command line tools, then I can try & develop something that works for you. Note that 'append' means that local users also exist & LDAP passwords get copied to local (& thence get checked locally) Replace with this to have it only check passwords in LDAP: auth.settings.login_methods=[ldap_auth(server='stbldap01.sun.ac.za', base_dn='ou=users,O=SU'] > from gluon.contrib.login_methods.ldap_auth import ldap_auth > ImportError: No module named login_methods.ldap_auth > I am working on a Debian testing/sid system with python 2.5, the > latest web2py and python-ldap installed. 'lastest web2py' isn't an ideal term. I use latest Bzr & the file is present & works I checked the Source downloadable for version 1.64.1 & can see the file there. What happens when you run from Web2Py Shell? python web2py.py -S welcome -M >>> from gluon.contrib.login_methods.ldap_auth import ldap_auth Works on an Ubuntu hardy box running Python 2.5.2 (Src downloadable of 1.64.1) Best Wishes, Fran. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---