pub struct ClientCredentialsSource { /* private fields */ }Expand description
Acquires tokens via the OAuth2 client_credentials grant (RFC 6749 §4.4).
POSTs grant_type=client_credentials + client_id + client_secret
to token_url and extracts access_token + expires_in from the
JSON response.
Implementations§
Trait Implementations§
Source§impl TokenSource for ClientCredentialsSource
impl TokenSource for ClientCredentialsSource
Source§fn fetch_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(String, Duration), TokenCacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(String, Duration), TokenCacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch a fresh token. Returns the raw JWT string and its lifetime.
The cache subtracts
TokenCacheConfig::refresh_skew from the TTL
before storing the expiry, so the token is treated as stale slightly
before the server considers it expired.Auto Trait Implementations§
impl !RefUnwindSafe for ClientCredentialsSource
impl !UnwindSafe for ClientCredentialsSource
impl Freeze for ClientCredentialsSource
impl Send for ClientCredentialsSource
impl Sync for ClientCredentialsSource
impl Unpin for ClientCredentialsSource
impl UnsafeUnpin for ClientCredentialsSource
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request