Skip to content

Commit 9007b0b

Browse files
Merge pull request #23 from mdsol/small-improvements
Small improvements
2 parents d47455a + b1a067d commit 9007b0b

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "mauth-client"
3-
version = "0.6.1"
3+
version = "0.7.0"
44
authors = ["Mason Gup <mgup@mdsol.com>"]
55
edition = "2024"
6+
rust-version = "1.88"
67
documentation = "https://docs.rs/mauth-client/"
78
license = "MIT"
89
description = "Sign requests and validate responses using the Medidata MAuth protocol"
@@ -15,17 +16,17 @@ categories = ["authentication", "web-programming"]
1516
[dependencies]
1617
reqwest = { version = "0.12", features = ["json"] }
1718
reqwest-middleware = "0.4"
18-
reqwest-tracing = { version = "0.5.6", optional = true }
19+
reqwest-tracing = { version = "0.5.8", optional = true }
1920
async-trait = ">= 0.1.83"
2021
url = "2"
2122
serde = { version = "1", features = ["derive"] }
2223
serde_json = "1"
23-
serde_yml = "0.0.10"
24+
serde_yml = ">= 0.0.10"
2425
uuid = { version = "1", features = ["v4"] }
2526
dirs = "5"
2627
chrono = "0.4"
2728
tokio = { version = "1", features = ["fs"] }
28-
tower = { version = "0.4", optional = true }
29+
tower = { version = ">= 0.4", optional = true }
2930
axum = { version = ">= 0.8", optional = true }
3031
futures-core = { version = "0.3", optional = true }
3132
http = "1"
@@ -42,3 +43,5 @@ axum-service = ["tower", "futures-core", "axum", "bytes", "tracing"]
4243
tracing-otel-26 = ["reqwest-tracing/opentelemetry_0_26"]
4344
tracing-otel-27 = ["reqwest-tracing/opentelemetry_0_27"]
4445
tracing-otel-28 = ["reqwest-tracing/opentelemetry_0_28"]
46+
tracing-otel-29 = ["reqwest-tracing/opentelemetry_0_29"]
47+
tracing-otel-30 = ["reqwest-tracing/opentelemetry_0_30"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ implements Axum's `OptionalFromRequestParts`, so you can more easily retrieve it
182182

183183
### OpenTelemetry Integration
184184

185-
There are also optional features `tracing-otel-26`, `tracing-otel-27`, and `tracing-otel-28`
185+
There are also optional features `tracing-otel-26` through `tracing-otel-30`
186186
that pair with the `axum-service` feature to ensure that any outgoing requests for credentials
187187
that take place in the context of an incoming web request also include the proper OpenTelemetry
188188
span information in any requests to MAudit services. Note that it is critical to use the same

src/config.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ impl MAuthInfo {
6565
#[cfg(any(
6666
feature = "tracing-otel-26",
6767
feature = "tracing-otel-27",
68-
feature = "tracing-otel-28"
68+
feature = "tracing-otel-28",
69+
feature = "tracing-otel-29",
70+
feature = "tracing-otel-30",
6971
))]
7072
let builder = builder.with(reqwest_tracing::TracingMiddleware::default());
7173
builder.build()
@@ -124,7 +126,7 @@ impl From<mauth_core::error::Error> for ConfigReadError {
124126
fn from(err: mauth_core::error::Error) -> ConfigReadError {
125127
match err {
126128
mauth_core::error::Error::PrivateKeyDecodeError(pkey_err) => {
127-
ConfigReadError::PrivateKeyDecodeError(format!("{}", pkey_err))
129+
ConfigReadError::PrivateKeyDecodeError(format!("{pkey_err}"))
128130
}
129131
_ => panic!("should not be possible to get this error type from signer construction"),
130132
}

src/validate_incoming.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,16 @@ impl MAuthInfo {
259259
match mauth_response {
260260
Err(_) => None,
261261
Ok(response) => {
262-
if let Ok(response_obj) = response.json::<serde_json::Value>().await {
263-
if let Some(pub_key_str) = response_obj
262+
if let Ok(response_obj) = response.json::<serde_json::Value>().await
263+
&& let Some(pub_key_str) = response_obj
264264
.pointer("/security_token/public_key_str")
265265
.and_then(|s| s.as_str())
266266
.map(|st| st.to_owned())
267-
{
268-
if let Ok(verifier) = Verifier::new(*app_uuid, pub_key_str) {
269-
let mut key_store = PUBKEY_CACHE.write().unwrap();
270-
key_store.insert(*app_uuid, verifier.clone());
271-
Some(verifier)
272-
} else {
273-
None
274-
}
275-
} else {
276-
None
277-
}
267+
&& let Ok(verifier) = Verifier::new(*app_uuid, pub_key_str)
268+
{
269+
let mut key_store = PUBKEY_CACHE.write().unwrap();
270+
key_store.insert(*app_uuid, verifier.clone());
271+
Some(verifier)
278272
} else {
279273
None
280274
}

0 commit comments

Comments
 (0)