pub struct Authenticator {
pub client: Client,
/* private fields */
}Expand description
Authenticator is responsible for fetching tokens, handling refreshing tokens, and optionally persisting tokens to disk.
Fields§
§client: Clientclient field is public so that it may be used for sending requests with the authorization header built from the received token
Implementations§
Source§impl Authenticator
impl Authenticator
Sourcepub async fn token<'a, T>(
&'a self,
scopes: &'a [T],
) -> Result<AccessToken, Error>
pub async fn token<'a, T>( &'a self, scopes: &'a [T], ) -> Result<AccessToken, Error>
Return the current token for the provided scopes.
Sourcepub async fn header<'a, T>(&self, scopes: &'a [T]) -> Result<String, Error>
pub async fn header<'a, T>(&self, scopes: &'a [T]) -> Result<String, Error>
returns value for the Authorization header (Bearer
Sourcepub async fn force_refreshed_token<'a, T>(
&'a self,
scopes: &'a [T],
) -> Result<AccessToken, Error>
pub async fn force_refreshed_token<'a, T>( &'a self, scopes: &'a [T], ) -> Result<AccessToken, Error>
Return a token for the provided scopes, but don’t reuse cached tokens. Instead, always fetch a new token from the OAuth server.
Auto Trait Implementations§
impl !Freeze for Authenticator
impl !RefUnwindSafe for Authenticator
impl !Send for Authenticator
impl !Sync for Authenticator
impl Unpin for Authenticator
impl !UnwindSafe for Authenticator
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> 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 more