pub struct LdapConnectionManager { /* private fields */ }Expand description
A bb8::ManageConnection implementation for ldap3 async connections.
Implementations§
Source§impl LdapConnectionManager
impl LdapConnectionManager
Sourcepub fn new<S: Into<String>>(ldap_url: S) -> Result<Self, LdapError>
pub fn new<S: Into<String>>(ldap_url: S) -> Result<Self, LdapError>
Creates a new LdapConnectionManager with the given LDAP URL.
The URL is parsed and validated. Valid schemes are ldap and ldapi.
Note: ldaps:// is not accepted. To use TLS, pass an ldap:// URL and configure
StartTLS via LdapConnSettings::set_starttls(true).
§Errors
Returns LdapError::UrlParsing if the URL is malformed.
Returns LdapError::UnknownScheme if the scheme is not ldap or ldapi.
Sourcepub fn with_connection_settings(self, settings: LdapConnSettings) -> Self
pub fn with_connection_settings(self, settings: LdapConnSettings) -> Self
Update the LDAP connection settings for this manager.
Sourcepub fn with_bind_credentials<S: Into<String>>(
self,
bind_dn: S,
bind_password: S,
) -> Self
pub fn with_bind_credentials<S: Into<String>>( self, bind_dn: S, bind_password: S, ) -> Self
Configures a simple bind to be performed when new connections are created.
The bind_dn is the distinguished name to bind as (e.g., "cn=admin,dc=example,dc=org").
The bind_password is the password for the bind DN.
The bind is performed immediately after each connection is established, before the connection is returned from the pool.
Sourcepub fn with_validation_timeout(self, timeout: Duration) -> Self
pub fn with_validation_timeout(self, timeout: Duration) -> Self
Overrides the timeout used by is_valid health checks.
The timeout specifies the maximum duration to wait for the validation search.
The default is 1 second.
Sourcepub fn with_validation_search<S: Into<String>>(
self,
base_dn: S,
scope: Scope,
filter: S,
attributes: Vec<S>,
) -> Self
pub fn with_validation_search<S: Into<String>>( self, base_dn: S, scope: Scope, filter: S, attributes: Vec<S>, ) -> Self
Overrides the validation search performed by is_valid.
base_dn: The base DN for the search. Default:""(root DSE).scope: The search scope. Default:Scope::Base.filter: The search filter. Default:"(objectClass=*)".attributes: The attributes to return. Default:["1.1"](no attributes).
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
Sets a timeout applied when establishing new connections.
This timeout is applied during connect() on a clone of the configured
LdapConnSettings, and overrides any timeout previously set on those settings.
Trait Implementations§
Source§impl Clone for LdapConnectionManager
impl Clone for LdapConnectionManager
Source§fn clone(&self) -> LdapConnectionManager
fn clone(&self) -> LdapConnectionManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LdapConnectionManager
impl Debug for LdapConnectionManager
Source§impl ManageConnection for LdapConnectionManager
Implements bb8::ManageConnection to provide connection pooling for ldap3::Ldap connections.
impl ManageConnection for LdapConnectionManager
Implements bb8::ManageConnection to provide connection pooling for ldap3::Ldap connections.
connect()establishes a new LDAP connection and optionally performs a simple bind if credentials are configured.is_valid()validates a connection by performing a lightweight LDAP search with the configured timeout.has_broken()returnstrueif the underlying channel is closed (though this doesn’t guarantee full bidirectional health).