pub struct TokenCredentialProvider { /* private fields */ }Expand description
TokenCredentialProvider loads a raw OAuth access token from memory or a file path.
Implementations§
Source§impl TokenCredentialProvider
impl TokenCredentialProvider
Sourcepub fn new(access_token: impl Into<String>) -> Self
pub fn new(access_token: impl Into<String>) -> Self
Create a new TokenCredentialProvider from an access token string.
Sourcepub fn from_path(path: impl Into<String>) -> Self
pub fn from_path(path: impl Into<String>) -> Self
Create a new TokenCredentialProvider from a token file path.
Sourcepub fn with_expires_at(self, expires_at: Timestamp) -> Self
pub fn with_expires_at(self, expires_at: Timestamp) -> Self
Set an absolute expiration time for the token.
Sourcepub fn with_expires_in(self, expires_in: Duration) -> Self
pub fn with_expires_in(self, expires_in: Duration) -> Self
Set a relative expiration duration for the token.
The expiration is evaluated when credentials are loaded.
Trait Implementations§
Source§impl Clone for TokenCredentialProvider
impl Clone for TokenCredentialProvider
Source§fn clone(&self) -> TokenCredentialProvider
fn clone(&self) -> TokenCredentialProvider
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 moreSource§impl Debug for TokenCredentialProvider
impl Debug for TokenCredentialProvider
Source§impl ProvideCredential for TokenCredentialProvider
impl ProvideCredential for TokenCredentialProvider
Source§type Credential = Credential
type Credential = Credential
Credential returned by this loader. Read more
Source§async fn provide_credential(
&self,
ctx: &Context,
) -> Result<Option<Self::Credential>>
async fn provide_credential( &self, ctx: &Context, ) -> Result<Option<Self::Credential>>
Load signing credential from current env.
Auto Trait Implementations§
impl Freeze for TokenCredentialProvider
impl RefUnwindSafe for TokenCredentialProvider
impl Send for TokenCredentialProvider
impl Sync for TokenCredentialProvider
impl Unpin for TokenCredentialProvider
impl UnsafeUnpin for TokenCredentialProvider
impl UnwindSafe for TokenCredentialProvider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> ProvideCredentialDyn for Twhere
T: ProvideCredential + ?Sized,
impl<T> ProvideCredentialDyn for Twhere
T: ProvideCredential + ?Sized,
Source§type Credential = <T as ProvideCredential>::Credential
type Credential = <T as ProvideCredential>::Credential
Credential returned by this loader.
Source§fn provide_credential_dyn<'a>(
&'a self,
ctx: &'a Context,
) -> Pin<Box<dyn Future<Output = Result<Option<<T as ProvideCredentialDyn>::Credential>, Error>> + Send + 'a>>
fn provide_credential_dyn<'a>( &'a self, ctx: &'a Context, ) -> Pin<Box<dyn Future<Output = Result<Option<<T as ProvideCredentialDyn>::Credential>, Error>> + Send + 'a>>
Dyn version of
ProvideCredential::provide_credential.