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§
Required Methods§
sourcefn 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 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
sourcefn 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 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 useclock
: the clock sourceupstream_oauth_provider
: the upstream OAuth provider for which to create the sessionstate
: the authorization grantstate
parameter sent to the upstream OAuth providercode_challenge_verifier
: the code challenge verifier used in this session, if PKCE is being usednonce
: thenonce
used in this session
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn 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 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,
Mark a session as completed and associate the given link
Returns the updated session
§Parameters
clock
: the clock sourceupstream_oauth_authorization_session
: the session to updateupstream_oauth_link
: the link to associate with the sessionid_token
: the ID token returned by the upstream OAuth provider, if present
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn 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,
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 sourceupstream_oauth_authorization_session
: the session to consume
§Errors
Returns Self::Error
if the underlying repository fails