pub struct RefreshTokenService<S: ?Sized> { /* private fields */ }Expand description
Refresh workflow combining strict JWT checks, a shared instance coordinator, and product CAS. The coordinator can be reused while products rebuild signers for dynamic lifetime configuration.
Implementations§
Source§impl<S: RefreshSessionStore + ?Sized> RefreshTokenService<S>
impl<S: RefreshSessionStore + ?Sized> RefreshTokenService<S>
Sourcepub fn new(
signer: JwtSigner,
verifier: JwtVerifier,
store: Arc<S>,
clock: Arc<dyn Clock>,
policy: RefreshPolicy,
coordinator: RefreshCoordinator,
) -> Self
pub fn new( signer: JwtSigner, verifier: JwtVerifier, store: Arc<S>, clock: Arc<dyn Clock>, policy: RefreshPolicy, coordinator: RefreshCoordinator, ) -> Self
Creates a workflow using the product-owned, cloneable coordinator resource.
Sourcepub async fn refresh(
&self,
token: &str,
client: ClientContext,
) -> Result<RefreshOutcome, RefreshError<S::Error>>
pub async fn refresh( &self, token: &str, client: ClientContext, ) -> Result<RefreshOutcome, RefreshError<S::Error>>
Rotates or rejects a refresh credential. Dropping the future releases coordination resources.
§Errors
Returns classified mechanism failures or the original store error; a failed commit never returns credentials. If the response is lost after commit, retrying cannot mint another pair.
Sourcepub async fn refresh_with_cancellation(
&self,
token: &str,
client: ClientContext,
cancel: &CancellationToken,
) -> Result<RefreshOutcome, RefreshError<S::Error>>
pub async fn refresh_with_cancellation( &self, token: &str, client: ClientContext, cancel: &CancellationToken, ) -> Result<RefreshOutcome, RefreshError<S::Error>>
Refreshes with cancellation while queued or before entering persistence. Once a store transaction starts, it is allowed to finish, preserving explicit commit semantics rather than returning cancellation with an unknown mutation outcome. Shutdown rejects new/queued work; products drain already-started transactions before closing the writer database.
§Errors
Returns cancellation/resource/auth failures or the original store/commit error.