Skip to main content

MiddlewareExt

Trait MiddlewareExt 

Source
pub(crate) trait MiddlewareExt:
    'static
    + Send
    + Sync {
    // Required methods
    fn current_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<(String, i64)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn renew_token<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, LoginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Implemented by token handlers to expose stored token state and a renewal hook. The middleware owns the coalescing decision under the MiddlewareWrapper mutex.

Required Methods§

Source

fn current_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<(String, i64)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the stored access token and its expiration timestamp (Unix seconds), or None if no token state is available.

Source

fn renew_token<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, LoginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Renew the access token from the upstream identity service and persist the result.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§