pub struct AuthStorage { /* private fields */ }Expand description
Main auth storage struct
Implementations§
Source§impl AuthStorage
impl AuthStorage
Sourcepub fn with_backend<B: AuthStorageBackend + 'static>(backend: B) -> Self
pub fn with_backend<B: AuthStorageBackend + 'static>(backend: B) -> Self
Create with explicit storage backend
Sourcepub fn set_runtime_key(&self, provider: &str, api_key: String)
pub fn set_runtime_key(&self, provider: &str, api_key: String)
Set a runtime API key override (from CLI –api-key)
Sourcepub fn remove_runtime_key(&self, provider: &str)
pub fn remove_runtime_key(&self, provider: &str)
Remove a runtime override
Sourcepub fn get_status(&self, provider: &str) -> AuthStatus
pub fn get_status(&self, provider: &str) -> AuthStatus
Get auth status for a provider
Sourcepub fn get_api_key(&self, provider: &str) -> Option<String>
pub fn get_api_key(&self, provider: &str) -> Option<String>
Get API key for a provider
Priority:
- Runtime override (CLI –api-key)
- Stored API key
- OAuth token (auto-refreshed)
- Environment variable
Sourcepub fn set_api_key(&self, provider: &str, key: String)
pub fn set_api_key(&self, provider: &str, key: String)
Set API key for a provider
Sourcepub fn set_oauth(
&self,
provider: &str,
access_token: String,
refresh_token: Option<String>,
expires_at: u64,
)
pub fn set_oauth( &self, provider: &str, access_token: String, refresh_token: Option<String>, expires_at: u64, )
Set OAuth credential for a provider
Sourcepub fn list_providers(&self) -> Vec<String>
pub fn list_providers(&self) -> Vec<String>
List all providers with credentials
Sourcepub fn get_all(&self) -> HashMap<String, AuthCredential>
pub fn get_all(&self) -> HashMap<String, AuthCredential>
Get all credentials (for debugging)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthStorage
impl RefUnwindSafe for AuthStorage
impl Send for AuthStorage
impl Sync for AuthStorage
impl Unpin for AuthStorage
impl UnsafeUnpin for AuthStorage
impl UnwindSafe for AuthStorage
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().