pub trait CompatAccessTokenRepository: Send + Sync {
    type Error;

    // Required methods
    fn lookup<'life0, 'async_trait>(
        &'life0 mut self,
        id: Ulid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_token<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        access_token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        compat_session: &'life3 CompatSession,
        token: String,
        expires_after: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn expire<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        compat_access_token: CompatAccessToken,
    ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A CompatAccessTokenRepository helps interacting with [CompatAccessToken] saved in the storage backend

Required Associated Types§

source

type Error

The error type returned by the repository

Required Methods§

source

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup a compat access token by its ID

Returns the compat access token if it exists, None otherwise

§Parameters
  • id: The ID of the compat access token to lookup
§Errors

Returns Self::Error if the underlying repository fails

source

fn find_by_token<'life0, 'life1, 'async_trait>( &'life0 mut self, access_token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find a compat access token by its token

Returns the compat access token if found, None otherwise

§Parameters
  • access_token: The token of the compat access token to lookup
§Errors

Returns Self::Error if the underlying repository fails

source

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, compat_session: &'life3 CompatSession, token: String, expires_after: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a new compat access token to the database

Returns the newly created compat access token

§Parameters
  • rng: The random number generator to use
  • clock: The clock used to generate timestamps
  • compat_session: The compat session associated with the access token
  • token: The token of the access token
  • expires_after: The duration after which the access token expires, if specified
§Errors

Returns Self::Error if the underlying repository fails

source

fn expire<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, compat_access_token: CompatAccessToken, ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the expiration time of the compat access token to now

Returns the expired compat access token

§Parameters
  • clock: The clock used to generate timestamps
  • compat_access_token: The compat access token to expire

Implementations on Foreign Types§

source§

impl<R> CompatAccessTokenRepository for Box<R>

§

type Error = <R as CompatAccessTokenRepository>::Error

source§

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn find_by_token<'life0, 'life1, 'async_trait>( &'life0 mut self, access_token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<CompatAccessToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, compat_session: &'life3 CompatSession, token: String, expires_after: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn expire<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, compat_access_token: CompatAccessToken, ) -> Pin<Box<dyn Future<Output = Result<CompatAccessToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§