pub struct StaticTokenProvider {
pub token: SensitiveString,
}Expand description
A fixed token, from an environment variable say. It prints as [REDACTED], so a {:?}
of the provider — or of anything holding one — cannot put the token in a log.
Fields§
§token: SensitiveStringThe token every request goes out with.
Implementations§
Source§impl StaticTokenProvider
impl StaticTokenProvider
Sourcepub fn new(token: impl Into<SensitiveString>) -> StaticTokenProvider
pub fn new(token: impl Into<SensitiveString>) -> StaticTokenProvider
A provider that hands out token and nothing else.
Trait Implementations§
Source§impl Clone for StaticTokenProvider
impl Clone for StaticTokenProvider
Source§fn clone(&self) -> StaticTokenProvider
fn clone(&self) -> StaticTokenProvider
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 StaticTokenProvider
impl Debug for StaticTokenProvider
Source§impl TokenProvider for StaticTokenProvider
impl TokenProvider for StaticTokenProvider
Source§fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The token to send, asked for on every request.
Source§fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asked once when a request is answered with 401. Answer
true when the next
access_token will hand out renewed credentials, and the request is sent again.Auto Trait Implementations§
impl Freeze for StaticTokenProvider
impl RefUnwindSafe for StaticTokenProvider
impl Send for StaticTokenProvider
impl Sync for StaticTokenProvider
impl Unpin for StaticTokenProvider
impl UnsafeUnpin for StaticTokenProvider
impl UnwindSafe for StaticTokenProvider
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