struct TokenManager {
auth: AuthConfig,
client: Arc<OutboundClient>,
ssl_verify: bool,
timeout: Duration,
cached: Mutex<Option<CachedToken>>,
}Expand description
Caches the OAuth2 access token and refreshes it near expiry.
Fields§
§auth: AuthConfig§client: Arc<OutboundClient>§ssl_verify: bool§timeout: Duration§cached: Mutex<Option<CachedToken>>Implementations§
Source§impl TokenManager
impl TokenManager
Sourceasync fn access_token(&self) -> Result<String, String>
async fn access_token(&self) -> Result<String, String>
Returns a valid access token, refreshing via the JWT-bearer grant when the cached one is absent or near expiry.
Auto Trait Implementations§
impl !Freeze for TokenManager
impl !RefUnwindSafe for TokenManager
impl Send for TokenManager
impl Sync for TokenManager
impl Unpin for TokenManager
impl UnsafeUnpin for TokenManager
impl !UnwindSafe for TokenManager
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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