Skip to content

Commit e5959e9

Browse files
authored
Merge pull request #23 from Iizuki/feature-prune
Feature prune and minor touch ups
2 parents 29de419 + 9567063 commit e5959e9

File tree

5 files changed

+40
-22
lines changed

5 files changed

+40
-22
lines changed

.github/workflows/publish.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
image: openidentityplatform/opendj
1515
ports:
1616
- 1389:1389
17-
options: >
17+
options: >
1818
--env ROOT_USER_DN="cn=manager"
1919
2020
steps:
@@ -48,8 +48,24 @@ jobs:
4848
- name: Run tests
4949
run: cargo test --verbose
5050

51+
# Check that there are no SemVer violations before releasing.
52+
# https://github.com/obi1kenobi/cargo-semver-checks
53+
- name: Check semver
54+
uses: obi1kenobi/cargo-semver-checks-action@v2
55+
with:
56+
feature-group: default-features
57+
features: pool
58+
59+
# Another check with the mutually exclusive tls-rustls feature enabled.
60+
- name: Check semver
61+
uses: obi1kenobi/cargo-semver-checks-action@v2
62+
with:
63+
feature-group: only-explicit-features
64+
features: tls-rustls,pool
65+
66+
5167
- name: Deploy to crates.io
5268
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5369
run: cargo publish
5470
env:
55-
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
71+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ readme = "README.md"
66
repository = "https://github.com/keaz/simple-ldap"
77
keywords = ["ldap", "ldap3", "async", "high-level"]
88
name = "simple-ldap"
9-
version = "4.0.0"
9+
version = "5.0.0"
1010
edition = "2021"
1111

1212

1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

1515
[dependencies]
1616
deadpool = { version = "0.12.2", optional = true }
17+
derive_more = { version = "2.0.1", features = ["debug"] }
1718
futures = "0.3.31"
1819
ldap3 = { version = "0.11.5", default-features = false }
1920
serde = { version = "1.0.214", features = ["derive"] }
@@ -33,9 +34,7 @@ tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
3334
uuid = { version = "1.12.1", features = ["v4"] }
3435

3536
[features]
36-
default = ["tls"]
37-
tls = ["ldap3/tls"]
37+
default = ["tls-native"]
3838
tls-native = ["ldap3/tls-native"]
3939
tls-rustls = ["ldap3/tls-rustls"]
40-
gssapi = ["ldap3/gssapi"]
4140
pool = ["dep:deadpool"]

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A ldap client library that wraps [ldap3](https://github.com/inejge/ldap3) to mak
66
[![Crates.io](https://img.shields.io/crates/v/simple-ldap)](https://crates.io/crates/simple-ldap)
77
[![Documentation](https://docs.rs/simple-ldap/badge.svg)](https://docs.rs/simple-ldap)
88

9+
910
## Usage
1011

1112
Adding `simple_ldap` as a dependency to your project:
@@ -20,9 +21,6 @@ Other useful pieces you'll likely need:
2021
cargo add url serde --features serde/derive
2122
```
2223

23-
## ⚠️ Important Note
24-
25-
**By default, this library enables the `tls` feature, which is an alias for `tls-native`. If you want to use `tls-rustls`, you have to disable the default feature by using `default-features = false` in your `Cargo.toml` file, as it conflicts with `tls-native`. Then, enable the feature you want to use.**
2624

2725
### Example
2826

src/filter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/// # Filter
2-
///
3-
/// This module contains the implementation of the LDAP filter.
4-
///
1+
//! # Filter
2+
//!
3+
//! This module contains the implementation of the LDAP filter.
4+
//!
55
66
/// The `Filter` trait is implemented by all the filters.
77
pub trait Filter: Send {

src/lib.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
//!
1515
//! ## Usage
1616
//!
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:
2118
//!
19+
//! ```commandline
20+
//! cargo add simple-ldap
2221
//! ```
2322
//!
23+
//! Most functionalities are defined on the `LdapClient` type. Have a look at the docs.
24+
//!
25+
//!
2426
//! ### Example
2527
//!
2628
//! Examples of individual operations are scattered throughout the docs, but here's the basic usage:
@@ -67,12 +69,10 @@
6769
//!
6870
//! ## Compile time features
6971
//!
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.
7374
//! * `pool` - Enable connection pooling
7475
//!
75-
//!
7676
7777
use std::{
7878
collections::{HashMap, HashSet},
@@ -100,23 +100,28 @@ pub extern crate ldap3;
100100
const LDAP_ENTRY_DN: &str = "entryDN";
101101
const NO_SUCH_RECORD: u32 = 32;
102102

103+
103104
/// Configuration and authentication for LDAP connection
104-
#[derive(Clone)]
105+
#[derive(derive_more::Debug, Clone)]
105106
pub struct LdapConfig {
106107
pub ldap_url: Url,
107108
/// DistinguishedName, aka the "username" to use for the connection.
108109
pub bind_dn: String,
110+
#[debug(skip)] // We don't want to print passwords.
109111
pub bind_password: String,
110112
pub dn_attribute: Option<String>,
111113
/// Low level configuration for the connection.
112114
/// You can probably skip it.
115+
#[debug(skip)] // Debug omitted, because it just doesn't implement it.
113116
pub connection_settings: Option<LdapConnSettings>,
114117
}
115118

119+
116120
///
117121
/// High-level LDAP client wrapper ontop of ldap3 crate. This wrapper provides a high-level interface to perform LDAP operations
118122
/// including authentication, search, update, delete
119123
///
124+
#[derive(Debug, Clone)]
120125
pub struct LdapClient {
121126
/// The internal connection handle.
122127
ldap: Ldap,

0 commit comments

Comments
 (0)