phi/src/phi/ldap/client.py

30 lines
1.1 KiB
Python
Raw Normal View History

2017-12-16 23:03:03 +01:00
from ldap3.utils.log import set_library_log_detail_level, PROTOCOL
from phi.logging import get_logger
from phi.ldap.connection import make_connection
log = get_logger(__name__)
set_library_log_detail_level(PROTOCOL)
class Client:
def __init__(self, host=None, port=389,
encryption=None, ciphers=None, validate=False,
username=None, password=None,
base_dn=None):
self.host = host
self.port = port
self.encryption = encryption
self.ciphers = ciphers
self.validate = validate
self.username = username
self.password = password
self.base_dn = base_dn
self.connection = make_connection(host=self.host, port=self.port,
encryption=self.encryption,
ciphers=self.ciphers,
validate=self.validate,
username=self.username,
password=self.password)