pub struct RefreshTokenSourceBuilder<T>where
T: TokenRefresher,{ /* private fields */ }Expand description
Builder for a RefreshTokenSource.
Implementations§
Source§impl<T> RefreshTokenSourceBuilder<T>where
T: TokenRefresher,
impl<T> RefreshTokenSourceBuilder<T>where
T: TokenRefresher,
Sourcepub fn new(name: String, token_refresher: T) -> RefreshTokenSourceBuilder<T>
pub fn new(name: String, token_refresher: T) -> RefreshTokenSourceBuilder<T>
Creates a new builder for a RefreshTokenSource.
§Arguments
name- Name of the token source, used for logging.token_refresher- Ability to refresh the token.
Sourcepub fn with_initial_token(
self,
token: TokenWithExpiry,
) -> RefreshTokenSourceBuilder<T>
pub fn with_initial_token( self, token: TokenWithExpiry, ) -> RefreshTokenSourceBuilder<T>
Seed the token source with an already-fetched token.
When set, the background task publishes this token immediately on startup
without calling TokenRefresher::refresh first. The normal refresh
loop then takes over before the token expires.
Sourcepub fn min_token_lifetime(
self,
duration: Duration,
) -> RefreshTokenSourceBuilder<T>
pub fn min_token_lifetime( self, duration: Duration, ) -> RefreshTokenSourceBuilder<T>
Minimum lifetime a token must have to be considered valid when returned by get_token.
Sourcepub fn refresh_retry_delay(
self,
duration: Duration,
) -> RefreshTokenSourceBuilder<T>
pub fn refresh_retry_delay( self, duration: Duration, ) -> RefreshTokenSourceBuilder<T>
The delay between retries if the refresh function fails.
Sourcepub fn refresh_threshold(
self,
duration: Duration,
) -> RefreshTokenSourceBuilder<T>
pub fn refresh_threshold( self, duration: Duration, ) -> RefreshTokenSourceBuilder<T>
The duration before the token’s expiry when a refresh should be attempted.
Sourcepub fn refresh_timeout(self, duration: Duration) -> RefreshTokenSourceBuilder<T>
pub fn refresh_timeout(self, duration: Duration) -> RefreshTokenSourceBuilder<T>
The duration to wait for a refresh to complete when get_token is called before a timeout.
Sourcepub fn build(self) -> RefreshTokenSource
pub fn build(self) -> RefreshTokenSource
Build the RefreshTokenSource
Auto Trait Implementations§
impl<T> Freeze for RefreshTokenSourceBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for RefreshTokenSourceBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for RefreshTokenSourceBuilder<T>
impl<T> Sync for RefreshTokenSourceBuilder<T>
impl<T> Unpin for RefreshTokenSourceBuilder<T>where
T: Unpin,
impl<T> UnsafeUnpin for RefreshTokenSourceBuilder<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RefreshTokenSourceBuilder<T>where
T: UnwindSafe,
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
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> 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 moreSource§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