Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "mauth-client"
version = "0.6.1"
version = "0.7.0"
authors = ["Mason Gup <mgup@mdsol.com>"]
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"
Expand All @@ -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"
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -124,7 +126,7 @@ impl From<mauth_core::error::Error> 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"),
}
Expand Down
20 changes: 7 additions & 13 deletions src/validate_incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,16 @@ impl MAuthInfo {
match mauth_response {
Err(_) => None,
Ok(response) => {
if let Ok(response_obj) = response.json::<serde_json::Value>().await {
if let Some(pub_key_str) = response_obj
if let Ok(response_obj) = response.json::<serde_json::Value>().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
}
Expand Down