pub struct EnvTokenAuthProvider { /* private fields */ }Expand description
Provider that reads a token from the first present, non-empty environment variable in an ordered list and exposes it as token-as-password auth.
The variable names are supplied by the caller — this type owns the mechanism
(read env → build TransportAuth::Token), never the policy of which
variables or which forge. Returns Ok(None) when none of the variables are
set, so it is harmless to inject unconditionally in a chain.
Implementations§
Source§impl EnvTokenAuthProvider
impl EnvTokenAuthProvider
Sourcepub fn with_var(name: impl Into<String>) -> Self
pub fn with_var(name: impl Into<String>) -> Self
Create a provider that reads the single environment variable name.
Sourcepub fn with_vars<I, S>(names: I) -> Self
pub fn with_vars<I, S>(names: I) -> Self
Create a provider that reads the first present variable in names.
Sourcepub fn with_username(self, username: impl Into<String>) -> Self
pub fn with_username(self, username: impl Into<String>) -> Self
Override the basic-auth username paired with the token.
Trait Implementations§
Source§impl AuthProvider for EnvTokenAuthProvider
impl AuthProvider for EnvTokenAuthProvider
Source§fn transport_auth(
&self,
_remote: Option<&str>,
) -> AppResult<Option<TransportAuth>>
fn transport_auth( &self, _remote: Option<&str>, ) -> AppResult<Option<TransportAuth>>
Resolves transport auth for an optional remote name. Read more
Source§fn signing_config(&self) -> AppResult<Option<SigningConfig>>
fn signing_config(&self) -> AppResult<Option<SigningConfig>>
Resolves signing configuration for commit-producing operations. Read more
Source§impl Clone for EnvTokenAuthProvider
impl Clone for EnvTokenAuthProvider
Source§fn clone(&self) -> EnvTokenAuthProvider
fn clone(&self) -> EnvTokenAuthProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EnvTokenAuthProvider
impl RefUnwindSafe for EnvTokenAuthProvider
impl Send for EnvTokenAuthProvider
impl Sync for EnvTokenAuthProvider
impl Unpin for EnvTokenAuthProvider
impl UnsafeUnpin for EnvTokenAuthProvider
impl UnwindSafe for EnvTokenAuthProvider
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