Expand description
LDAP client library for Rust with async/await support, based on tokio.
TLS connectivity is supported via native-tls or rustls.
It is controlled by the feature flags tls-native-tls
and tls-rustls
, respectively.
A minimal Kerberos support is provided via gssapi
feature flag with the following limitations:
- SASL protection is not supported for plain connections, use TLS connection.
- Channel binding is not supported.
Usage example:
use futures::TryStreamExt;
use ldap_rs::{LdapClient, SearchRequest, SearchRequestDerefAliases, SearchRequestScope, TlsOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
pretty_env_logger::init_timed();
let options = TlsOptions::tls();
let mut client = LdapClient::builder("ldap-host.local")
.tls_options(options)
.connect()
.await?;
client
.simple_bind("cn=read-only-admin,dc=example,dc=com", "password")
.await?;
let req = SearchRequest::builder()
.base_dn("dc=example,dc=com")
.scope(SearchRequestScope::WholeSubtree)
.deref_aliases(SearchRequestDerefAliases::NeverDerefAliases)
.filter("(&(objectClass=person)(uid=ne*t*n))")
.build()?;
let result = client.search(req).await?;
let items = result.try_collect::<Vec<_>>().await?;
println!("Items: {items:#?}");
Ok(())
}
Re-exports§
pub use bytes;
pub use rasn_ldap;
pub use client::*;
pub use model::*;
pub use options::*;
pub use request::*;
Modules§
- Low-level LDAP channel operations
- LDAP client module
- LDAP controls
- LDAP errors
- Data structures
- OID definitions
- LDAP connection options
- LDAP request