LdapConnectionPool class
LdapConnectionPool implements a very simple connection pool handler.
To create a pool, pass in an LdapConnection:
var pool = LdapConnectionPool(ldapConnection);
The pool implements the LdapConnection interface. You can directly use the pool instance:
pool.search(...); pool.add(...)
Or alternatively, you can get a LdapConnection and return it to the pool when done:
var c = pool.getConnection();
c.search(....); c.add(..)
pool.releaseConnection(c);
The later approach is preferred if you want to alter the bind credentials or reuse the same connection.
Features not yet implemented:
- Health Checks
- ldap referral handling
- Multiple host support, HA fail over etc.
Constructors
- LdapConnectionPool(LdapConnection connection, {dynamic poolSize = 5, dynamic maxOpenRetries = 10, dynamic keepAliveTimerSeconds = 30, LdapFunction keepAliveFunction = _defaultKeepAliveFunction})
-
Create a connection pool based on a prototype LdapConnection. The pool
will be up to
poolSize
copies of the connection. An attempt to open the connection up tomaxOpenRetries
will be made with an interval of 10 seconds between each attempt. EverykeepAliveTimerSeconds
the pool will send a keep alive request to the server. The default keep alive function sends an Ldap Abandon request with message id = 0. Most servers will ignore this request.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
pool
↔ List<
LdapConnection> -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
String dn, Map< String, dynamic> attrs) → Future<LdapResult> -
Performs an LDAP add operation.
override
-
bind(
{String? DN, String? password}) → Future< LdapResult> -
Performs an LDAP BIND operation.
override
-
close(
) → Future< void> -
compare(
String dn, String attrName, String attrValue) → Future< LdapResult> -
Performs an LDAP compare operation.
override
-
delete(
String dn) → Future< LdapResult> -
Performs an LDAP delete operation.
override
-
destroy(
) → Future< void> -
getConnection(
{bool bind = false}) → Future< LdapConnection> -
Return a
LdapConnection
from the pool. Ifbind
is true An ldap bind will be performed using the credentials provided in the originalLdapConnection
used to create the pool. -
modify(
String dn, List< Modification> mods) → Future<LdapResult> -
Performs an LDAP modify operation.
override
-
modifyDN(
String dn, String rdn, {bool deleteOldRDN = true, String? newSuperior}) → Future< LdapResult> -
Performs an LDAP modifyDN operation.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
) → Future< void> -
query(
String baseDN, String query, List< String> attributes, {int scope = SearchScope.SUB_LEVEL, int sizeLimit = 0, List<Control> controls = const []}) → Future<SearchResult> -
Like the search method, but the filter is constructed using the
query string. See https://tools.ietf.org/html/rfc2254
inherited
-
releaseConnection(
LdapConnection c, {bool repairBadConnection = false}) → Future< void> - Release a connection back to the pool If repairBadConnection is true, try to repair the connection by closing/opening
-
search(
String baseDN, Filter filter, List< String> attributes, {int scope = SearchScope.SUB_LEVEL, int sizeLimit = 0, List<Control> controls = const <Control>[]}) → Future<SearchResult> -
Performs an LDAP search operation.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited