pub struct AuthManager { /* private fields */ }Expand description
Manages provider credentials stored in auth.toml
Implementations§
Source§impl AuthManager
impl AuthManager
Sourcepub fn new(config_dir: &Path) -> OAuthResult<Self>
pub fn new(config_dir: &Path) -> OAuthResult<Self>
Load auth manager for the given config directory
Sourcepub fn from_default_dir() -> OAuthResult<Self>
pub fn from_default_dir() -> OAuthResult<Self>
Load auth manager from the default Stakpak config directory (~/.stakpak/)
Sourcepub fn get(&self, profile: &str, provider: &str) -> Option<&ProviderAuth>
pub fn get(&self, profile: &str, provider: &str) -> Option<&ProviderAuth>
Get credentials for a provider, respecting profile inheritance
Resolution order:
[{profile}.{provider}]- profile-specific[all.{provider}]- shared fallback
Sourcepub fn set(
&mut self,
profile: &str,
provider: &str,
auth: ProviderAuth,
) -> OAuthResult<()>
pub fn set( &mut self, profile: &str, provider: &str, auth: ProviderAuth, ) -> OAuthResult<()>
Set credentials for a provider in a specific profile
Sourcepub fn remove(&mut self, profile: &str, provider: &str) -> OAuthResult<bool>
pub fn remove(&mut self, profile: &str, provider: &str) -> OAuthResult<bool>
Remove credentials for a provider from a specific profile
Sourcepub fn list_for_profile(&self, profile: &str) -> HashMap<String, &ProviderAuth>
pub fn list_for_profile(&self, profile: &str) -> HashMap<String, &ProviderAuth>
Get all credentials for a specific profile (including inherited from “all”)
Sourcepub fn has_credentials(&self) -> bool
pub fn has_credentials(&self) -> bool
Check if any credentials are configured
Sourcepub fn update_oauth_tokens(
&mut self,
profile: &str,
provider: &str,
access: &str,
refresh: &str,
expires: i64,
) -> OAuthResult<()>
pub fn update_oauth_tokens( &mut self, profile: &str, provider: &str, access: &str, refresh: &str, expires: i64, ) -> OAuthResult<()>
Update OAuth tokens for a provider (used during token refresh)
Trait Implementations§
Source§impl Clone for AuthManager
impl Clone for AuthManager
Source§fn clone(&self) -> AuthManager
fn clone(&self) -> AuthManager
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 moreAuto Trait Implementations§
impl Freeze for AuthManager
impl RefUnwindSafe for AuthManager
impl Send for AuthManager
impl Sync for AuthManager
impl Unpin for AuthManager
impl UnwindSafe for AuthManager
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