From e4890b457b700133a3531089cbeae782f07dacdf Mon Sep 17 00:00:00 2001 From: devitway Date: Sun, 15 Mar 2026 21:42:49 +0000 Subject: [PATCH] v0.2.29: upstream auth, remove dead code, version bump - Remove unused DockerAuth::fetch_with_auth() method - Fix basic_auth_header docstring - Bump to v0.2.29 --- Cargo.lock | 6 ++-- Cargo.toml | 2 +- nora-registry/src/config.rs | 1 - nora-registry/src/registry/docker_auth.rs | 43 ----------------------- 4 files changed, 4 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4568fa0..a2629af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1247,7 +1247,7 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" [[package]] name = "nora-cli" -version = "0.2.28" +version = "0.2.29" dependencies = [ "clap", "flate2", @@ -1261,7 +1261,7 @@ dependencies = [ [[package]] name = "nora-registry" -version = "0.2.28" +version = "0.2.29" dependencies = [ "async-trait", "axum", @@ -1299,7 +1299,7 @@ dependencies = [ [[package]] name = "nora-storage" -version = "0.2.28" +version = "0.2.29" dependencies = [ "axum", "base64", diff --git a/Cargo.toml b/Cargo.toml index 9710309..929e97c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ ] [workspace.package] -version = "0.2.28" +version = "0.2.29" edition = "2021" license = "MIT" authors = ["DevITWay "] diff --git a/nora-registry/src/config.rs b/nora-registry/src/config.rs index 1fe840d..0fe73b9 100644 --- a/nora-registry/src/config.rs +++ b/nora-registry/src/config.rs @@ -9,7 +9,6 @@ use std::fs; pub use crate::secrets::SecretsConfig; /// Encode "user:pass" into a Basic Auth header value, e.g. "Basic dXNlcjpwYXNz". -/// Returns None if input is None. pub fn basic_auth_header(credentials: &str) -> String { format!("Basic {}", STANDARD.encode(credentials)) } diff --git a/nora-registry/src/registry/docker_auth.rs b/nora-registry/src/registry/docker_auth.rs index 8a02dab..e13c7b9 100644 --- a/nora-registry/src/registry/docker_auth.rs +++ b/nora-registry/src/registry/docker_auth.rs @@ -110,49 +110,6 @@ impl DockerAuth { .and_then(|v| v.as_str()) .map(String::from) } - - /// Make an authenticated request to an upstream registry - pub async fn fetch_with_auth( - &self, - url: &str, - registry_url: &str, - name: &str, - basic_auth: Option<&str>, - ) -> Result { - // First try — with basic auth if configured, otherwise anonymous - let mut request = self.client.get(url); - if let Some(credentials) = basic_auth { - request = request.header("Authorization", basic_auth_header(credentials)); - } - let response = request.send().await.map_err(|_| ())?; - - if response.status() == reqwest::StatusCode::UNAUTHORIZED { - // Extract Www-Authenticate header - let www_auth = response - .headers() - .get("www-authenticate") - .and_then(|v| v.to_str().ok()) - .map(String::from); - - // Get token and retry - if let Some(token) = self - .get_token(registry_url, name, www_auth.as_deref(), basic_auth) - .await - { - return self - .client - .get(url) - .header("Authorization", format!("Bearer {}", token)) - .send() - .await - .map_err(|_| ()); - } - - return Err(()); - } - - Ok(response) - } } impl Default for DockerAuth {