pub trait OAuth2RefreshTokenRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<RefreshToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RefreshToken>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
session: &'life3 Session,
access_token: &'life4 AccessToken,
refresh_token: String,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn consume<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
refresh_token: RefreshToken,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
An OAuth2RefreshTokenRepository
helps interacting with RefreshToken
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<RefreshToken>, 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<RefreshToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup a refresh token by its ID
Returns None
if no RefreshToken
was found
§Parameters
id
: The ID of theRefreshToken
to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RefreshToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_token<'life0, 'life1, 'async_trait>(
&'life0 mut self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RefreshToken>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find a refresh token by its token
Returns None
if no RefreshToken
was found
§Parameters
token
: The token of theRefreshToken
to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
session: &'life3 Session,
access_token: &'life4 AccessToken,
refresh_token: String,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
session: &'life3 Session,
access_token: &'life4 AccessToken,
refresh_token: String,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Add a new refresh token to the database
Returns the newly created RefreshToken
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampssession
: TheSession
in which to create theRefreshToken
access_token
: TheAccessToken
created alongside thisRefreshToken
refresh_token
: The refresh token to store
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn consume<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
refresh_token: RefreshToken,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, 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,
refresh_token: RefreshToken,
) -> Pin<Box<dyn Future<Output = Result<RefreshToken, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Consume a refresh token
Returns the updated RefreshToken
§Parameters
clock
: The clock used to generate timestampsrefresh_token
: TheRefreshToken
to consume
§Errors
Returns Self::Error
if the underlying repository fails, or if the
token was already consumed