pub struct AuthResolver { /* private fields */ }Expand description
A resolver for container registry credentials.
The resolver checks multiple sources in order of precedence to find credentials for a given registry.
Implementations§
Source§impl AuthResolver
impl AuthResolver
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new resolver with the default Docker config.
Loads the config from DOCKER_CONFIG or ~/.docker/config.json.
If the config doesn’t exist, uses an empty config.
Sourcepub fn with_config(config: DockerConfig) -> Self
pub fn with_config(config: DockerConfig) -> Self
Creates a new resolver with a specific Docker config.
Sourcepub fn with_explicit(self, credential: Credential) -> Self
pub fn with_explicit(self, credential: Credential) -> Self
Sets explicit credentials that override all other sources.
Sourcepub fn resolve(&self, registry: &str) -> Result<Credential>
pub fn resolve(&self, registry: &str) -> Result<Credential>
Resolves credentials for a registry.
Returns the credential to use, following the resolution order:
- Explicit credentials
- Docker config auths
- Registry-specific helper
- Default credential store
- Anonymous
Sourcepub fn resolve_or_anonymous(&self, registry: &str) -> Credential
pub fn resolve_or_anonymous(&self, registry: &str) -> Credential
Resolves credentials for a registry, returning anonymous on any error.
This is useful when you want to try authenticated access but fall back to anonymous if there are any issues with credential resolution.
Trait Implementations§
Source§impl Clone for AuthResolver
impl Clone for AuthResolver
Source§fn clone(&self) -> AuthResolver
fn clone(&self) -> AuthResolver
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AuthResolver
impl Debug for AuthResolver
Auto Trait Implementations§
impl Freeze for AuthResolver
impl RefUnwindSafe for AuthResolver
impl Send for AuthResolver
impl Sync for AuthResolver
impl Unpin for AuthResolver
impl UnsafeUnpin for AuthResolver
impl UnwindSafe for AuthResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more