Skip to content

Commit

Permalink
fix: include auth token in display (alloy-rs#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored and ben186 committed Jul 27, 2024
1 parent 215df91 commit 281a1bc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/transport/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use std::{fmt, net::SocketAddr};
/// Use to inject username and password or an auth token into requests
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Authorization {
/// HTTP Basic Auth
/// [RC7617](https://datatracker.ietf.org/doc/html/rfc7617) HTTP Basic Auth
Basic(String),
/// Bearer Auth
/// [RFC6750](https://datatracker.ietf.org/doc/html/rfc6750) Bearer Auth
Bearer(String),
}

Expand Down Expand Up @@ -39,7 +39,7 @@ impl Authorization {
Self::authority(format!("{username}:{password}"))
}

/// Instantiate a new bearer auth.
/// Instantiate a new bearer auth from the given token.
pub fn bearer(token: impl Into<String>) -> Self {
Self::Bearer(token.into())
}
Expand All @@ -48,8 +48,8 @@ impl Authorization {
impl fmt::Display for Authorization {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Authorization::Basic(_) => write!(f, "Basic"),
Authorization::Bearer(_) => write!(f, "Bearer"),
Authorization::Basic(auth) => write!(f, "Basic {auth}"),
Authorization::Bearer(auth) => write!(f, "Bearer {auth}"),
}
}
}

0 comments on commit 281a1bc

Please sign in to comment.