pub struct AuthenticationStorage { /* private fields */ }
Expand description
This struct implements storage and access of authentication information backed by multiple storage backends (e.g. keyring and file storage) Credentials are stored and retrieved from the backends in the order they are added to the storage
Implementations§
source§impl AuthenticationStorage
impl AuthenticationStorage
sourcepub fn add_backend(&mut self, backend: Arc<dyn StorageBackend + Send + Sync>)
pub fn add_backend(&mut self, backend: Arc<dyn StorageBackend + Send + Sync>)
Add a new storage backend to the authentication storage (backends are tried in the order they are added)
sourcepub fn store(&self, host: &str, authentication: &Authentication) -> Result<()>
pub fn store(&self, host: &str, authentication: &Authentication) -> Result<()>
Store the given authentication information for the given host
sourcepub fn get(&self, host: &str) -> Result<Option<Authentication>>
pub fn get(&self, host: &str) -> Result<Option<Authentication>>
Retrieve the authentication information for the given host
sourcepub fn get_by_url<U: IntoUrl>(
&self,
url: U
) -> Result<(Url, Option<Authentication>), Error>
pub fn get_by_url<U: IntoUrl>( &self, url: U ) -> Result<(Url, Option<Authentication>), Error>
Retrieve the authentication information for the given URL (including the authentication information for the wildcard host if no credentials are found for the given host)
E.g. if credentials are stored for *.prefix.dev
and the
given URL is https://repo.prefix.dev
, the credentials
for *.prefix.dev
will be returned.
Trait Implementations§
source§impl Clone for AuthenticationStorage
impl Clone for AuthenticationStorage
source§fn clone(&self) -> AuthenticationStorage
fn clone(&self) -> AuthenticationStorage
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more