pub trait UpstreamOAuthSessionRepository: Send + Sync {
    type Error;

    // Required methods
    fn lookup<'life0, 'async_trait>(
        &'life0 mut self,
        id: Ulid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UpstreamOAuthAuthorizationSession>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        upstream_oauth_provider: &'life3 UpstreamOAuthProvider,
        state: String,
        code_challenge_verifier: Option<String>,
        nonce: String,
    ) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthAuthorizationSession, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn complete_with_link<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        upstream_oauth_authorization_session: UpstreamOAuthAuthorizationSession,
        upstream_oauth_link: &'life2 UpstreamOAuthLink,
        id_token: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthAuthorizationSession, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn consume<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        upstream_oauth_authorization_session: UpstreamOAuthAuthorizationSession,
    ) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthAuthorizationSession, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An UpstreamOAuthSessionRepository helps interacting with UpstreamOAuthAuthorizationSession 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<UpstreamOAuthAuthorizationSession>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup a session by its ID

Returns None if the session does not exist

§Parameters
  • id: the ID of the session 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, upstream_oauth_provider: &'life3 UpstreamOAuthProvider, state: String, code_challenge_verifier: Option<String>, nonce: String, ) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthAuthorizationSession, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a session to the database

Returns the newly created session

§Parameters
  • rng: the random number generator to use
  • clock: the clock source
  • upstream_oauth_provider: the upstream OAuth provider for which to create the session
  • state: the authorization grant state parameter sent to the upstream OAuth provider
  • code_challenge_verifier: the code challenge verifier used in this session, if PKCE is being used
  • nonce: the nonce used in this session
§Errors

Returns Self::Error if the underlying repository fails

Mark a session as completed and associate the given link

Returns the updated session

§Parameters
  • clock: the clock source
  • upstream_oauth_authorization_session: the session to update
  • upstream_oauth_link: the link to associate with the session
  • id_token: the ID token returned by the upstream OAuth provider, if present
§Errors

Returns Self::Error if the underlying repository fails

source

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

Mark a session as consumed

Returns the updated session

§Parameters
  • clock: the clock source
  • upstream_oauth_authorization_session: the session to consume
§Errors

Returns Self::Error if the underlying repository fails

Implementations on Foreign Types§

source§

impl<R> UpstreamOAuthSessionRepository for Box<R>

source§

type Error = <R as UpstreamOAuthSessionRepository>::Error

source§

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

source§

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, upstream_oauth_provider: &'life3 UpstreamOAuthProvider, state: String, code_challenge_verifier: Option<String>, nonce: String, ) -> Pin<Box<dyn Future<Output = Result<UpstreamOAuthAuthorizationSession, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

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

Implementors§