pub trait ReplayCacheBackend: Send + Sync {
// Required method
fn check_and_record<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), ReplayCacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A backend that stores and checks seen JWT IDs.
Required Methods§
Sourcefn check_and_record<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), ReplayCacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_and_record<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), ReplayCacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether jti has been seen before, and record it if not.
§Returns
Ok(())if this is the first time thejtihas been seen (accepted).Err(ReplayCacheError::Replayed)if thejtiwas already stored.Err(ReplayCacheError::Backend(_))on a transient backend error.
§Errors
Returns ReplayCacheError::Replayed when replay is detected.
Returns ReplayCacheError::Backend on storage failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".