Crates.io | deadpool-ldap |
lib.rs | deadpool-ldap |
version | 0.3.1 |
source | src |
created_at | 2020-11-13 09:42:53.959992 |
updated_at | 2022-07-26 14:49:58.061301 |
description | LDAP support for the deadpool connection pool |
homepage | |
repository | https://github.com/c0dearm/deadpool-ldap |
max_upload_size | |
id | 311888 |
size | 20,214 |
Deadpool is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool
manager for ldap3
Feature | Description | Default |
---|---|---|
tls-native |
Enable support for TLS connections using tokio-native-tls |
no |
tls-rustls |
Enable support for TLS connections using tokio-rustls |
no |
use deadpool_ldap::{Manager, Pool};
#[tokio::main]
async fn main() {
let manager = Manager::new("ldap://example.org");
let pool = Pool::builder(manager).max_size(5).build().unwrap();
let mut client = pool.get().await.unwrap();
result = client.simple_bind("uid=user,dc=example,dc=org", "password").await;
assert!(result.is_ok());
}
To send custom ldap connection settings use .with_connection_settings() on the manager.
use deadpool_ldap::{Manager, Pool};
use ldap3::LdapConnSettings;
#[tokio::main]
async fn main() {
let manager = Manager::new("ldap://example.org")
.with_connection_settings(
LdapConnSettings::new()
.set_conn_timeout(Duration::from_secs(30))
);
let pool = Pool::builder(manager).max_size(5).build().unwrap();
let mut client = pool.get().await.unwrap();
result = client.simple_bind("uid=user,dc=example,dc=org", "password").await;
assert!(result.is_ok());
}
Licensed under either of
Choose at your option!