diff --git a/Cargo.toml b/Cargo.toml index 9a2555c..ee400b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "mauth-client" -version = "0.6.1" +version = "0.7.0" authors = ["Mason Gup "] edition = "2024" +rust-version = "1.88" documentation = "https://docs.rs/mauth-client/" license = "MIT" description = "Sign requests and validate responses using the Medidata MAuth protocol" @@ -15,17 +16,17 @@ categories = ["authentication", "web-programming"] [dependencies] reqwest = { version = "0.12", features = ["json"] } reqwest-middleware = "0.4" -reqwest-tracing = { version = "0.5.6", optional = true } +reqwest-tracing = { version = "0.5.8", optional = true } async-trait = ">= 0.1.83" url = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" -serde_yml = "0.0.10" +serde_yml = ">= 0.0.10" uuid = { version = "1", features = ["v4"] } dirs = "5" chrono = "0.4" tokio = { version = "1", features = ["fs"] } -tower = { version = "0.4", optional = true } +tower = { version = ">= 0.4", optional = true } axum = { version = ">= 0.8", optional = true } futures-core = { version = "0.3", optional = true } http = "1" @@ -42,3 +43,5 @@ axum-service = ["tower", "futures-core", "axum", "bytes", "tracing"] tracing-otel-26 = ["reqwest-tracing/opentelemetry_0_26"] tracing-otel-27 = ["reqwest-tracing/opentelemetry_0_27"] tracing-otel-28 = ["reqwest-tracing/opentelemetry_0_28"] +tracing-otel-29 = ["reqwest-tracing/opentelemetry_0_29"] +tracing-otel-30 = ["reqwest-tracing/opentelemetry_0_30"] diff --git a/README.md b/README.md index 008ab6e..ff6e6e2 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ implements Axum's `OptionalFromRequestParts`, so you can more easily retrieve it ### OpenTelemetry Integration -There are also optional features `tracing-otel-26`, `tracing-otel-27`, and `tracing-otel-28` +There are also optional features `tracing-otel-26` through `tracing-otel-30` that pair with the `axum-service` feature to ensure that any outgoing requests for credentials that take place in the context of an incoming web request also include the proper OpenTelemetry span information in any requests to MAudit services. Note that it is critical to use the same diff --git a/src/config.rs b/src/config.rs index dfcded8..55e24c0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -65,7 +65,9 @@ impl MAuthInfo { #[cfg(any( feature = "tracing-otel-26", feature = "tracing-otel-27", - feature = "tracing-otel-28" + feature = "tracing-otel-28", + feature = "tracing-otel-29", + feature = "tracing-otel-30", ))] let builder = builder.with(reqwest_tracing::TracingMiddleware::default()); builder.build() @@ -124,7 +126,7 @@ impl From for ConfigReadError { fn from(err: mauth_core::error::Error) -> ConfigReadError { match err { mauth_core::error::Error::PrivateKeyDecodeError(pkey_err) => { - ConfigReadError::PrivateKeyDecodeError(format!("{}", pkey_err)) + ConfigReadError::PrivateKeyDecodeError(format!("{pkey_err}")) } _ => panic!("should not be possible to get this error type from signer construction"), } diff --git a/src/validate_incoming.rs b/src/validate_incoming.rs index 2077765..a99cefd 100644 --- a/src/validate_incoming.rs +++ b/src/validate_incoming.rs @@ -259,22 +259,16 @@ impl MAuthInfo { match mauth_response { Err(_) => None, Ok(response) => { - if let Ok(response_obj) = response.json::().await { - if let Some(pub_key_str) = response_obj + if let Ok(response_obj) = response.json::().await + && let Some(pub_key_str) = response_obj .pointer("/security_token/public_key_str") .and_then(|s| s.as_str()) .map(|st| st.to_owned()) - { - if let Ok(verifier) = Verifier::new(*app_uuid, pub_key_str) { - let mut key_store = PUBKEY_CACHE.write().unwrap(); - key_store.insert(*app_uuid, verifier.clone()); - Some(verifier) - } else { - None - } - } else { - None - } + && let Ok(verifier) = Verifier::new(*app_uuid, pub_key_str) + { + let mut key_store = PUBKEY_CACHE.write().unwrap(); + key_store.insert(*app_uuid, verifier.clone()); + Some(verifier) } else { None }