#digest #auth #reqwest #async

diqwest

Trait to extend reqwest for digest auth flow

7 releases (4 stable)

Uses new Rust 2021

1.1.1 Jan 13, 2023
1.1.0 Aug 26, 2022
1.0.1 May 29, 2022
0.1.2 Oct 14, 2021

#63 in Authentication

Download history 92/week @ 2022-10-08 153/week @ 2022-10-15 45/week @ 2022-10-22 56/week @ 2022-10-29 123/week @ 2022-11-05 134/week @ 2022-11-12 53/week @ 2022-11-19 32/week @ 2022-11-26 191/week @ 2022-12-03 269/week @ 2022-12-10 152/week @ 2022-12-17 59/week @ 2022-12-24 145/week @ 2022-12-31 182/week @ 2023-01-07 99/week @ 2023-01-14 95/week @ 2023-01-21

527 downloads per month
Used in fewer than 6 crates

MIT license

16KB
235 lines

diqwest

This crate extends reqwest to be able to send requests with digest auth flow.

When you send a request with digest auth flow this first request will be executed. In case the response is a 401 the www-authenticate header is parsed and the answer is calculated. The initial request is executed again with additional Authorization header. The response will be returned from send_with_digest_auth().

In case the first response is not a 401 this first response is returned from send_with_digest_auth() without any manipulation. In case the first response is a 401 but the www-authenticate header is missing the first reponse is returned as well.

Examples

Async (default)

use diqwest::WithDigestAuth;
use reqwest::{Client, Response};

// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
  .get("url")
  .send_with_digest_auth("username", "password")
  .await?;

Blocking (feature flag blocking has to be enabled in Cargo.toml)

use diqwest::blocking::WithDigestAuth;
use reqwest::blocking::{Client, Response};

// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
  .get("url")
  .send_with_digest_auth("username", "password")?;

Dependencies

~4–12MB
~246K SLoC