pub struct StaticTokenProvider { /* private fields */ }Expand description
A fixed token — a personal access token, or one read from the environment. It prints as
[REDACTED], so a {:?} of the provider cannot put the token in a log.
Implementations§
Source§impl StaticTokenProvider
impl StaticTokenProvider
Sourcepub fn new(token: impl Into<SensitiveString>) -> StaticTokenProvider
pub fn new(token: impl Into<SensitiveString>) -> StaticTokenProvider
A provider over one token.
Trait Implementations§
Source§impl Clone for StaticTokenProvider
impl Clone for StaticTokenProvider
Source§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 now.
Source§fn refreshable(&self) -> bool
fn refreshable(&self) -> bool
Whether
TokenProvider::refresh can do anything. A provider that answers false
is never asked, and a 401 surfaces at once.Source§fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asked once when a request is answered with 401. Answer
true when the next
TokenProvider::access_token hands out renewed credentials, and the request is
sent again. Concurrent 401s are coalesced by the client: only one refresh runs at a
time, and a request that arrives while one is in flight waits for its outcome.Auto Trait Implementations§
impl Forget for StaticTokenProvider
impl Freeze for StaticTokenProvider
impl Move 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