pub struct AuthClient { /* private fields */ }Expand description
Provider-neutral check-lock-check authentication and persistent token lifecycle.
Implementations§
Source§impl AuthClient
impl AuthClient
Sourcepub fn new(
key: String,
flow: Arc<dyn TokenProvider>,
store: Arc<dyn CredentialStore>,
options: AuthOptions,
) -> Self
pub fn new( key: String, flow: Arc<dyn TokenProvider>, store: Arc<dyn CredentialStore>, options: AuthOptions, ) -> Self
Bind one credential identity to its acquisition provider and store.
Sourcepub fn store_name(&self) -> &'static str
pub fn store_name(&self) -> &'static str
Return the active store’s backend identifier.
Sourcepub async fn login(&self) -> Result<Token>
pub async fn login(&self) -> Result<Token>
Acquire and persist a new credential under an exclusive refresh lock.
Sourcepub async fn token(&self) -> Result<Token>
pub async fn token(&self) -> Result<Token>
Load or refresh without starting an interactive login for a missing credential.
Sourcepub async fn token_or_login(&self) -> Result<Token>
pub async fn token_or_login(&self) -> Result<Token>
Load or refresh, permitting login when the store has no credential.
Sourcepub async fn force_refresh(&self) -> Result<Token>
pub async fn force_refresh(&self) -> Result<Token>
Renew even before the refresh window, without forcing an interactive login.
Sourcepub async fn refresh_rejected_token(
&self,
stale_access_token: &str,
) -> Result<Token>
pub async fn refresh_rejected_token( &self, stale_access_token: &str, ) -> Result<Token>
Refresh a rejected token unless another process already replaced it.
Trait Implementations§
Source§impl AuthSession for AuthClient
impl AuthSession for AuthClient
Source§fn auth_client(&self) -> &AuthClient
fn auth_client(&self) -> &AuthClient
Return the shared client that owns this session’s lifecycle.
Source§fn store_name(&self) -> &'static str
fn store_name(&self) -> &'static str
Identify the active credential store.
Source§fn token_with_login<'life0, 'async_trait>(
&'life0 self,
login: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn token_with_login<'life0, 'async_trait>(
&'life0 self,
login: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve binding login policy: true forces login, false forbids it, None allows it.
Source§fn login<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn login<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Explicitly acquire and persist a new credential.
Source§fn token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load or renew a credential without initiating an interactive login.
Source§fn token_or_login<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn token_or_login<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load or renew a credential, allowing login when none is stored.
Source§fn force_refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn force_refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Renew the stored credential even when it has not reached its refresh window.
Source§fn refresh_rejected_token<'life0, 'life1, 'async_trait>(
&'life0 self,
stale: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn refresh_rejected_token<'life0, 'life1, 'async_trait>(
&'life0 self,
stale: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reuse another caller’s replacement or renew the rejected credential.
Auto Trait Implementations§
impl !RefUnwindSafe for AuthClient
impl !UnwindSafe for AuthClient
impl Freeze for AuthClient
impl Send for AuthClient
impl Sync for AuthClient
impl Unpin for AuthClient
impl UnsafeUnpin for AuthClient
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