Skip to content

BasicAuth - #69

Open
bx9001 wants to merge 2 commits into
masterfrom
cmk_36791
Open

BasicAuth#69
bx9001 wants to merge 2 commits into
masterfrom
cmk_36791

Conversation

@bx9001

@bx9001 bx9001 commented Sep 7, 2026

Copy link
Copy Markdown

No description provided.

@bx9001
bx9001 marked this pull request as ready for review September 8, 2026 08:40
@bx9001
bx9001 requested a review from relrod September 8, 2026 08:40
@bx9001 bx9001 changed the title WIP: BasicAuth BasicAuth Sep 8, 2026
#[test]
fn otel_password_without_username_parses() {
let args = parse(&["--otel-password", "McBobberson"])
.expect("a password alone is rejected later, not by clap");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why defer this to later and not use requires = "otel_username"?


/// Password for basic-auth against the OTel collector. Requires a
/// username
#[arg(long, env = "RUSTIK_OTEL_PASSWORD", hide_env_values = true)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires = "otel_username"

Comment thread metrics-cache/src/main.rs
.install_default()
.expect("Failed to install rustls crypto provider");

let otel_client = match &args.otel_endpoint {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move this up?

Comment on lines +21 to +22
let username = username.filter(|value| !value.is_empty());
let password = password.filter(|value| !value.is_empty());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does clap's value_parser = clap::builder::NonEmptyStringValueParser::new() option on the username param solve what you are trying to do here?

@relrod

relrod commented Sep 11, 2026

Copy link
Copy Markdown
Member

Could we add a test asserting that the outgoing request has the expected Authorization header when credentials are configured, and no header otherwise? The current tests only exercise credential resolution.

For example you can split the reqwest client build into its own method and then check request.headers()["authorization"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants