|
14 | 14 | //! |
15 | 15 | //! ## Usage |
16 | 16 | //! |
17 | | -//! Add this to your `Cargo.toml`: |
18 | | -//! ```toml |
19 | | -//! [dependencies] |
20 | | -//! simple-ldap = "3.0.0" |
| 17 | +//! Adding `simple_ldap` as a dependency to your project: |
21 | 18 | //! |
| 19 | +//! ```commandline |
| 20 | +//! cargo add simple-ldap |
22 | 21 | //! ``` |
23 | 22 | //! |
| 23 | +//! Most functionalities are defined on the `LdapClient` type. Have a look at the docs. |
| 24 | +//! |
| 25 | +//! |
24 | 26 | //! ### Example |
25 | 27 | //! |
26 | 28 | //! Examples of individual operations are scattered throughout the docs, but here's the basic usage: |
|
67 | 69 | //! |
68 | 70 | //! ## Compile time features |
69 | 71 | //! |
70 | | -//! * `tls` - (Enabled by default) Enables TLS support (delegates to `ldap3`'s `tls` feature) |
71 | | -//! * `tls-rustls` - Enables TLS support using `rustls` (delegates to `ldap3`'s `tls-rustls` feature) |
72 | | -//! * `gsasl` - Enables SASL support (delegates to `ldap3`'s `gsasl` feature) |
| 72 | +//! * `tls-native` - (Enabled by default) Enables TLS support using the systems native implementation. |
| 73 | +//! * `tls-rustls` - Enables TLS support using `rustls`. **Conflicts with `tls-native` so you need to disable default features to use this. |
73 | 74 | //! * `pool` - Enable connection pooling |
74 | 75 | //! |
75 | | -//! |
76 | 76 |
|
77 | 77 | use std::{ |
78 | 78 | collections::{HashMap, HashSet}, |
@@ -100,23 +100,28 @@ pub extern crate ldap3; |
100 | 100 | const LDAP_ENTRY_DN: &str = "entryDN"; |
101 | 101 | const NO_SUCH_RECORD: u32 = 32; |
102 | 102 |
|
| 103 | + |
103 | 104 | /// Configuration and authentication for LDAP connection |
104 | | -#[derive(Clone)] |
| 105 | +#[derive(derive_more::Debug, Clone)] |
105 | 106 | pub struct LdapConfig { |
106 | 107 | pub ldap_url: Url, |
107 | 108 | /// DistinguishedName, aka the "username" to use for the connection. |
108 | 109 | pub bind_dn: String, |
| 110 | + #[debug(skip)] // We don't want to print passwords. |
109 | 111 | pub bind_password: String, |
110 | 112 | pub dn_attribute: Option<String>, |
111 | 113 | /// Low level configuration for the connection. |
112 | 114 | /// You can probably skip it. |
| 115 | + #[debug(skip)] // Debug omitted, because it just doesn't implement it. |
113 | 116 | pub connection_settings: Option<LdapConnSettings>, |
114 | 117 | } |
115 | 118 |
|
| 119 | + |
116 | 120 | /// |
117 | 121 | /// High-level LDAP client wrapper ontop of ldap3 crate. This wrapper provides a high-level interface to perform LDAP operations |
118 | 122 | /// including authentication, search, update, delete |
119 | 123 | /// |
| 124 | +#[derive(Debug, Clone)] |
120 | 125 | pub struct LdapClient { |
121 | 126 | /// The internal connection handle. |
122 | 127 | ldap: Ldap, |
|
0 commit comments