Skip to content

LDAP support for the deadpool connection pool

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

c0dearm/deadpool-ldap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deadpool for LDAP

Deadpool is a dead simple async pool for connections and objects of any type.

This crate implements a deadpool manager for ldap3

Features

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

Basic usage

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());
}

Sending a custom LdapConnSettings

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());
}

License

Licensed under either of

Choose at your option!

About

LDAP support for the deadpool connection pool

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages