How to use the ldappool.StateConnector function in ldappool

To help you get started, we’ve selected a few ldappool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / keystone / keystone / identity / backends / ldap / common.py View on Github external
If 'use_auth_pool' is not enabled, then connection pooling is not used for
    those LDAP operations.

    Note, the python-ldap API requires all string attribute values to be UTF-8
    encoded. The KeystoneLDAPHandler enforces this prior to invoking the
    methods in this class.

    Note, in python-ldap some fields (DNs, RDNs, attribute names, queries)
    are represented as text (str on Python 3, unicode on Python 2 when
    bytes_mode=False). For more details see:
    http://www.python-ldap.org/en/latest/bytes_mode.html#bytes-mode

    """

    # Added here to allow override for testing
    Connector = ldappool.StateConnector
    auth_pool_prefix = 'auth_pool_'

    connection_pools = {}  # static connector pool dict

    def __init__(self, conn=None, use_auth_pool=False):
        super(PooledLDAPHandler, self).__init__(conn=conn)
        self.who = ''
        self.cred = ''
        self.conn_options = {}  # connection specific options
        self.page_size = None
        self.use_auth_pool = use_auth_pool
        self.conn_pool = None

    def connect(self, url, page_size=0, alias_dereferencing=None,
                use_tls=False, tls_cacertfile=None, tls_cacertdir=None,
                tls_req_cert=ldap.OPT_X_TLS_DEMAND, chase_referrals=None,

ldappool

A simple connector pool for python-ldap.

MPL-2.0
Latest version published 4 years ago

Package Health Score

37 / 100
Full package analysis