Install python-ldap
1. Download and install python-ldap (e.g. python-ldap-2.4.3.win32-py2.7)
Edit models/db.py
2. edit auth.define_tables() to allow login with username and not email.
auth.define_tables(username=True)
auth.settings.create_user_groups=False
3. Add the following at the bottom of page.
Replace server and base_dn to your setting.
# all we need is login
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
# you don't have to remember me
auth.settings.remember_me_form = False
# ldap authentication and not save password on web2py
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
server='OchibaServer',
base_dn='dc=ochiba,dc=com')]
Comments (5)
0
preactive 9 years ago
My AD uses case insensitive Login:Username so I had to adjust def user(): so I would not have multiple db.auth_user.id entries for one user: (see EDIT4:)
http://stackoverflow.com/questions/30511182/web2py-howto-auto-convert-username-field-to-uppercase
0
preactive 9 years ago
Works wonders! Thank-you!
I am running into a differnet issue that you may have insight on.
My users login and sometimes they do all CAPs and sometimes they do camelCase for their username and each time they login to generates a new DB entry and other assoc. tables for that new Auth_user.id.
I have posted my trials and errors to SO: http://stackoverflow.com/questions/30511182/web2py-howto-auto-convert-username-field-to-uppercase
Any help would be appricated. Thanks!
0
lgwapnitsky 12 years ago
0
ochiba77 12 years ago
0
nickvargish 13 years ago