pub struct AuthResolver { /* private fields */ }Expand description
Authentication resolver that converts AuthConfig to oci_client RegistryAuth
Implementations§
Source§impl AuthResolver
impl AuthResolver
Sourcepub fn new(config: AuthConfig) -> Self
pub fn new(config: AuthConfig) -> Self
Create a new authentication resolver
Sourcepub fn resolve(&self, image: &str) -> RegistryAuth
pub fn resolve(&self, image: &str) -> RegistryAuth
Resolve authentication for an image reference
Extracts the registry from the image reference and returns the appropriate
oci_client::secrets::RegistryAuth.
Sourcepub fn source_for_registry(&self, registry: &str) -> &AuthSource
pub fn source_for_registry(&self, registry: &str) -> &AuthSource
Return the AuthSource that would be used for the given registry hostname.
Looks up the per-registry map first, falling back to the default source.
Sourcepub fn resolve_source(
&self,
source: &AuthSource,
registry: &str,
) -> RegistryAuth
pub fn resolve_source( &self, source: &AuthSource, registry: &str, ) -> RegistryAuth
Resolve a specific AuthSource to RegistryAuth.
This is the synchronous resolution path. AuthSource::SecretStore
cannot be resolved synchronously and returns Anonymous with a
warning log.
Sourcepub fn normalize_registry(registry: &str) -> String
pub fn normalize_registry(registry: &str) -> String
Normalize a registry hostname for case-insensitive, scheme/slash insensitive matching.
Strips a leading http:// / https://, trims trailing /, and
lowercases. This lets a credential stored under https://ghcr.io/
(as a user might type it into zlayer login) match an image whose
extracted registry is ghcr.io.
Examples:
https://ghcr.io/->ghcr.ioGHCR.IO->ghcr.iolocalhost:5000->localhost:5000
Sourcepub fn extract_registry(image: &str) -> String
pub fn extract_registry(image: &str) -> String
Extract registry hostname from image reference
Examples:
- “ubuntu:latest” -> “docker.io”
- “ghcr.io/owner/repo:tag” -> “ghcr.io”
- “localhost:5000/image” -> “localhost:5000”