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
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "mauth-client"
version = "0.6.0"
version = "0.6.1"
authors = ["Mason Gup <mgup@mdsol.com>"]
edition = "2021"
edition = "2024"
documentation = "https://docs.rs/mauth-client/"
license = "MIT"
description = "Sign requests and validate responses using the Medidata MAuth protocol"
Expand All @@ -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"] }
Expand All @@ -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"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions src/axum_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{MAuthInfo, CLIENT};
use crate::{CLIENT, MAuthInfo};
use mauth_core::signer::Signer;
use reqwest::Client;
use reqwest::Url;
Expand Down Expand Up @@ -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()
});
Expand Down
2 changes: 1 addition & 1 deletion src/protocol_test_suite.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{config::ConfigFileSection, MAuthInfo};
use crate::{MAuthInfo, config::ConfigFileSection};
use reqwest::{Method, Request};
use serde::Deserialize;
use tokio::fs;
Expand Down
2 changes: 1 addition & 1 deletion src/reqwest_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/sign_outgoing.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/validate_incoming.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down
Loading