当前位置: 首页>>代码示例>>Python>>正文


Python Backend._connect方法代码示例

本文整理汇总了Python中ldapcherry.backend.backendLdap.Backend._connect方法的典型用法代码示例。如果您正苦于以下问题:Python Backend._connect方法的具体用法?Python Backend._connect怎么用?Python Backend._connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ldapcherry.backend.backendLdap.Backend的用法示例。


在下文中一共展示了Backend._connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testConnectSSL

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 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)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: testConnectStartTLS

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 def testConnectStartTLS(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldap://ldap.ldapcherry.org:390'
     cfg2['checkcert'] = 'off'
     cfg2['starttls'] = 'on'
     cfg2['ca'] = './test/cfg/ca.crt'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例3: testConnectSSLWrongCA

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 def testConnectSSLWrongCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     try:
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
     else:
         raise AssertionError("expected an exception")
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: testMissingCA

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 def testMissingCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637'
     cfg2['checkcert'] = 'on'
     cfg2['ca'] = './test/cfg/not_a_ca.crt'
     try:
         inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
         ldapc = inv._connect()
     except CaFileDontExist as e:
         return
     else:
         raise AssertionError("expected an exception")
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: testLdapUnavaible

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 def testLdapUnavaible(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://notaldap:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     try:
         ldapc = inv._connect()
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         return
     else:
         raise AssertionError("expected an exception")
开发者ID:,项目名称:,代码行数:14,代码来源:

示例6: testConnect

# 需要导入模块: from ldapcherry.backend.backendLdap import Backend [as 别名]
# 或者: from ldapcherry.backend.backendLdap.Backend import _connect [as 别名]
 def testConnect(self):
     inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
     return True
开发者ID:,项目名称:,代码行数:7,代码来源:


注:本文中的ldapcherry.backend.backendLdap.Backend._connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。