LdapConnection constructor
LdapConnection({
- String host = 'localhost',
- bool ssl = false,
- int port = Ldap.PORT_LDAP,
- String bindDN = '',
- String password = '',
- BadCertHandlerType badCertificateHandler = defaultBadCertHandler,
- SecurityContext? context,
Constructor for an LDAP connection to an LDAP directory server.
The connection is set to use ssl
(or not) to connect to port
at
host
, and optionally authenticated to bindDN
with password
.
The badCertHandler is set to badCertificateHandler
. If null,
a LdapCertificateException is thrown if the certificate is bad.
Exceptions
- ArgumentError when parameters are incorrect: host, bindDN or password is not a String or null; or port is not an int or null.
- StateError when the connection is currently open and the host, port, or ssl is changed. Close the connection before making changes.
Implementation
LdapConnection(
{String host = 'localhost',
bool ssl = false,
int port = Ldap.PORT_LDAP,
String bindDN = '',
String password = '',
BadCertHandlerType badCertificateHandler = defaultBadCertHandler,
SecurityContext? context})
: _host = host,
_port = port,
_bindDN = bindDN,
_password = password,
_isSSL = ssl,
_badCertHandler = badCertificateHandler {
_cmgr = ConnectionManager(this, tlsSecurityContext: _context);
}