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

Introduced handling of Authorization http header. For now "Bearer" to… #220

Closed
wants to merge 2 commits into from

Conversation

zajko
Copy link
Contributor

@zajko zajko commented Nov 17, 2023

…ken authentication is being handled. For now tokens and usernames are defined in the config file of sidecar

@zajko zajko requested a review from zacshowa November 17, 2023 15:55
…ken authentication is being handled. For now tokens and usernames are defined in the config file of sidecar
@zajko zajko force-pushed the token_based_authorization branch from def2a55 to 2c613a1 Compare November 20, 2023 07:47
@zajko zajko linked an issue Nov 20, 2023 that may be closed by this pull request
Copy link
Contributor

@zacshowa zacshowa left a comment

Choose a reason for hiding this comment

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

One comment about reqwest client manaagement in the tests. Other than that LGTM

Comment on lines +570 to +585
async fn fetch_data(port: u16, relative_path: &str, maybe_authorization: Option<&str>) -> Response {
let request_url = format!(
"http://{}:{}/{}",
Ipv4Addr::UNSPECIFIED,
port,
relative_path
);
let mut builder = reqwest::Client::new().get(request_url.clone());
if let Some(authorization) = maybe_authorization {
builder = builder.header("Authorization", authorization)
}
builder
.send()
.await
.unwrap_or_else(|_| panic!("Error requesting endpoint {}", request_url))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that in the future creating the clients like this for the tests could cause issues by attempting to initiate too many connections to the sidecar too quickly? If that isn't the case, I would say this is fine, there probably isn't a need to hyperoptimize the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each test spins up it's own instance of sidecar on a random port so it's not an issue

@zajko zajko closed this Jun 18, 2024
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.

[SSE Sidecar] Authentication with Bearer Token
2 participants