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

auth-server: api-auth: Do not remove API key from auth headers #56

Merged
merged 1 commit into from
Oct 29, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.gitattributes
**/.DS_Store

# Generated by Cargo
# will have compiled files and executables
Expand Down
4 changes: 2 additions & 2 deletions auth/auth-server/src/server/api_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ impl Server {
pub(crate) async fn authorize_request(
&self,
path: &str,
headers: &mut HeaderMap,
headers: &HeaderMap,
body: &[u8],
) -> Result<(), ApiError> {
// Check API auth
let api_key = headers
.remove(RENEGADE_API_KEY_HEADER)
.get(RENEGADE_API_KEY_HEADER)
.and_then(|h| h.to_str().ok().map(String::from)) // Convert to String
.and_then(|s| Uuid::parse_str(&s).ok()) // Use &s to parse
.ok_or(AuthServerError::unauthorized("Invalid or missing Renegade API key"))?;
Expand Down
4 changes: 2 additions & 2 deletions auth/auth-server/src/server/handle_external_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ impl Server {
pub async fn handle_external_match_request(
&self,
path: warp::path::FullPath,
mut headers: warp::hyper::HeaderMap,
headers: warp::hyper::HeaderMap,
body: Bytes,
) -> Result<impl Reply, Rejection> {
// Authorize the request
self.authorize_request(path.as_str(), &mut headers, &body).await?;
self.authorize_request(path.as_str(), &headers, &body).await?;

// Send the request to the relayer
let resp = self.send_admin_request(Method::POST, path.as_str(), headers, body).await?;
Expand Down
Loading