Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove remote_addr logs #44

Merged
merged 2 commits into from
Sep 23, 2024
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
resolver = "2"

[workspace.package]
version = '0.7.4'
version = '0.7.5'
edition = "2021"
authors = ["Glenn Gore <glenn@affinidi.com>"]
description = "Affinidi Trusted Messaging"
Expand Down
1 change: 0 additions & 1 deletion affinidi-messaging-mediator/src/common/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ impl IntoResponse for AppError {
#[derive(Clone, Debug, Serialize)]
pub struct Session {
pub session_id: String, // Unique session transaction ID
pub remote_addr: String, // Remote Socket address
pub authenticated: bool, // Has this session been authenticated?
pub challenge_sent: Option<String>, // Challenge sent to the client
pub did: String, // DID of the client
Expand Down
19 changes: 5 additions & 14 deletions affinidi-messaging-mediator/src/common/jwt_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
))
})?;

let remote_addr = if let Some(address) = parts
if let Some(address) = parts
.extensions
.get::<axum::extract::ConnectInfo<SocketAddr>>()
.map(|ci| ci.0)
Expand All @@ -117,10 +117,7 @@ where
.extract::<TypedHeader<Authorization<Bearer>>>()
.await
.map_err(|_| {
warn!(
"{}: No Authorization Bearer header in request!",
remote_addr
);
warn!("No Authorization Bearer header in request!");
AuthError::MissingCredentials
})?;

Expand All @@ -130,12 +127,7 @@ where
match jsonwebtoken::decode::<SessionClaims>(bearer.token(), decoding_key, &validation) {
Ok(token_data) => token_data,
Err(err) => {
event!(
Level::WARN,
"{}: decoding JWT failed {:?}",
remote_addr,
err
);
event!(Level::WARN, "Decoding JWT failed {:?}", err);
return Err(AuthError::InvalidToken);
}
}
Expand All @@ -148,13 +140,12 @@ where
let did_hash = digest(&did);

info!(
"{}: Protected connection accepted from address({}) did_hash({})",
&session_id, &remote_addr, &did_hash
"{}: Protected connection accepted from did_hash({})",
&session_id, &did_hash
);

let session = Session {
session_id,
remote_addr,
authenticated: true,
challenge_sent: None,
did,
Expand Down
Loading