Anonymous bind more simple
This commit is contained in:
parent
4a0bd3de91
commit
e21f1aa9e4
|
|
@ -144,7 +144,7 @@ class LDAPAuthHandler(AuthHandler):
|
||||||
'url': ('X-Ldap-URL', None),
|
'url': ('X-Ldap-URL', None),
|
||||||
'basedn': ('X-Ldap-BaseDN', None),
|
'basedn': ('X-Ldap-BaseDN', None),
|
||||||
'template': ('X-Ldap-Template', '(cn=%(username)s)'),
|
'template': ('X-Ldap-Template', '(cn=%(username)s)'),
|
||||||
'binddn': ('X-Ldap-BindDN', 'cn=anonymous'),
|
'binddn': ('X-Ldap-BindDN', ''),
|
||||||
'bindpasswd': ('X-Ldap-BindPass', ''),
|
'bindpasswd': ('X-Ldap-BindPass', ''),
|
||||||
'cookiename': ('X-CookieName', '')
|
'cookiename': ('X-CookieName', '')
|
||||||
}
|
}
|
||||||
|
|
@ -176,10 +176,7 @@ class LDAPAuthHandler(AuthHandler):
|
||||||
# ldap_obj.set_option(ldap.OPT_REFERRALS, 0)
|
# ldap_obj.set_option(ldap.OPT_REFERRALS, 0)
|
||||||
|
|
||||||
ctx['action'] = 'binding as search user'
|
ctx['action'] = 'binding as search user'
|
||||||
if ctx['binddn'] == 'cn=anonymous':
|
ldap_obj.bind_s(ctx['binddn'], ctx['bindpasswd'], ldap.AUTH_SIMPLE)
|
||||||
ldap_obj.simple_bind_s()
|
|
||||||
else:
|
|
||||||
ldap_obj.bind_s(ctx['binddn'], ctx['bindpasswd'], ldap.AUTH_SIMPLE)
|
|
||||||
|
|
||||||
ctx['action'] = 'preparing search filter'
|
ctx['action'] = 'preparing search filter'
|
||||||
searchfilter = ctx['template'] % { 'username': ctx['user'] }
|
searchfilter = ctx['template'] % { 'username': ctx['user'] }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue