diff --git a/Cargo.toml b/Cargo.toml index 10b7916..9a2555c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "mauth-client" -version = "0.6.0" +version = "0.6.1" authors = ["Mason Gup "] -edition = "2021" +edition = "2024" documentation = "https://docs.rs/mauth-client/" license = "MIT" description = "Sign requests and validate responses using the Medidata MAuth protocol" @@ -15,7 +15,7 @@ categories = ["authentication", "web-programming"] [dependencies] reqwest = { version = "0.12", features = ["json"] } reqwest-middleware = "0.4" -reqwest-tracing = { version = "0.5.5", optional = true } +reqwest-tracing = { version = "0.5.6", optional = true } async-trait = ">= 0.1.83" url = "2" serde = { version = "1", features = ["derive"] } @@ -41,3 +41,4 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros"] } 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"] diff --git a/README.md b/README.md index ba29e9f..008ab6e 100644 --- a/README.md +++ b/README.md @@ -182,10 +182,10 @@ implements Axum's `OptionalFromRequestParts`, so you can more easily retrieve it ### OpenTelemetry Integration -There are also optional features `tracing-otel-26` and `tracing-otel-27` 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 +There are also optional features `tracing-otel-26`, `tracing-otel-27`, and `tracing-otel-28` +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 version of OpenTelemetry crates as the rest of the project - if you do not, there will be 2 or more instances of the OpenTelemetry global information, and requests may not be traced through properly. diff --git a/src/axum_service.rs b/src/axum_service.rs index 4cdf1a6..cb76605 100644 --- a/src/axum_service.rs +++ b/src/axum_service.rs @@ -6,7 +6,7 @@ use axum::{ response::IntoResponse, }; use futures_core::future::BoxFuture; -use http::{request::Parts, Response, StatusCode}; +use http::{Response, StatusCode, request::Parts}; use std::convert::Infallible; use std::error::Error; use std::task::{Context, Poll}; @@ -15,8 +15,8 @@ use tracing::error; use crate::validate_incoming::{MAuthValidationError, ValidatedRequestDetails}; use crate::{ - config::{ConfigFileSection, ConfigReadError}, MAuthInfo, + config::{ConfigFileSection, ConfigReadError}, }; /// This is a Tower Service which validates that incoming requests have a valid diff --git a/src/config.rs b/src/config.rs index 4b47830..dfcded8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,4 +1,4 @@ -use crate::{MAuthInfo, CLIENT}; +use crate::{CLIENT, MAuthInfo}; use mauth_core::signer::Signer; use reqwest::Client; use reqwest::Url; @@ -62,7 +62,11 @@ impl MAuthInfo { CLIENT.get_or_init(|| { let builder = ClientBuilder::new(Client::new()).with(mauth_info.clone()); - #[cfg(any(feature = "tracing-otel-26", feature = "tracing-otel-27"))] + #[cfg(any( + feature = "tracing-otel-26", + feature = "tracing-otel-27", + feature = "tracing-otel-28" + ))] let builder = builder.with(reqwest_tracing::TracingMiddleware::default()); builder.build() }); diff --git a/src/protocol_test_suite.rs b/src/protocol_test_suite.rs index 31fa05d..c9413d0 100644 --- a/src/protocol_test_suite.rs +++ b/src/protocol_test_suite.rs @@ -1,4 +1,4 @@ -use crate::{config::ConfigFileSection, MAuthInfo}; +use crate::{MAuthInfo, config::ConfigFileSection}; use reqwest::{Method, Request}; use serde::Deserialize; use tokio::fs; diff --git a/src/reqwest_middleware.rs b/src/reqwest_middleware.rs index 80c6cb8..c33b8db 100644 --- a/src/reqwest_middleware.rs +++ b/src/reqwest_middleware.rs @@ -2,7 +2,7 @@ use http::Extensions; use reqwest::{Request, Response}; use reqwest_middleware::{Middleware, Next, Result}; -use crate::{sign_outgoing::SigningError, MAuthInfo}; +use crate::{MAuthInfo, sign_outgoing::SigningError}; #[async_trait::async_trait] impl Middleware for MAuthInfo { diff --git a/src/sign_outgoing.rs b/src/sign_outgoing.rs index 998c08b..331e81c 100644 --- a/src/sign_outgoing.rs +++ b/src/sign_outgoing.rs @@ -1,6 +1,6 @@ use crate::MAuthInfo; use chrono::prelude::*; -use reqwest::{header::HeaderValue, Request}; +use reqwest::{Request, header::HeaderValue}; use thiserror::Error; impl MAuthInfo { diff --git a/src/validate_incoming.rs b/src/validate_incoming.rs index dbfc870..2077765 100644 --- a/src/validate_incoming.rs +++ b/src/validate_incoming.rs @@ -1,4 +1,4 @@ -use crate::{MAuthInfo, CLIENT, PUBKEY_CACHE}; +use crate::{CLIENT, MAuthInfo, PUBKEY_CACHE}; use axum::extract::Request; use bytes::Bytes; use chrono::prelude::*;