def testConnectSSL(self): cfg2 = cfg.copy() cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637' cfg2['checkcert'] = 'on' inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid') ldap = inv._connect() ldap.simple_bind_s(inv.binddn, inv.bindpassword)
def testConnectSSL(self): cfg2 = cfg.copy() cfg2["uri"] = "ldaps://ldap.dnscherry.org:636" cfg2["checkcert"] = "on" inv = Auth(cfg2, cherrypy.log) ldap = inv._connect() ldap.simple_bind_s(inv.binddn, inv.bindpassword)
def testConnectSSL(self): cfg2 = cfg.copy() cfg2['uri'] = 'ldaps://ldap.dnscherry.org:636' cfg2['checkcert'] = 'on' inv = Auth(cfg2, cherrypy.log) ldap = inv._connect() ldap.simple_bind_s(inv.binddn, inv.bindpassword)
import ldap, sys, ldif from SearchResult import LDAPSearchResult ''' LDAP user authentication: 1)use admin‘s dn and pw information to initialize ldap 2) look for dn by usrname 3) verify user dn and pw notes: ldap.simple_bind_s() return 97 denote verification successful Verification failed will thrown exception ''' config = { 'ldap_server': 'LDAP://ldap.dlcloud.info', 'base_dn': 'cn=admin,dc=dlcloud,dc=info', 'base_pw': 'blcc@asc161' } # 1) ldap initilaize def ds3_ldap_init(config): # print(config['base_dn']) dn = config['base_dn'] pw = config['base_pw'] server = config['ldap_server'] con = ldap.initialize(server) try: bind = con.simple_bind_s(dn, pw) print(bind) return con except ldap.LDAPError as e:
def testConnect(self): inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid') ldap = inv._connect() ldap.simple_bind_s(inv.binddn, inv.bindpassword) return True
def testConnect(self): inv = Auth(cfg, cherrypy.log) ldap = inv._connect() ldap.simple_bind_s(inv.binddn, inv.bindpassword) return True