pub trait OAuth2AuthorizationGrantRepository: Send + Sync {
type Error;
// Required methods
fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
redirect_uri: Url,
scope: Scope,
code: Option<AuthorizationCode>,
state: Option<String>,
nonce: Option<String>,
max_age: Option<NonZeroU32>,
response_mode: ResponseMode,
response_type_id_token: bool,
requires_consent: bool,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_code<'life0, 'life1, 'async_trait>(
&'life0 mut self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fulfill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: &'life2 Session,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn exchange<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn give_consent<'life0, 'async_trait>(
&'life0 mut self,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
An OAuth2AuthorizationGrantRepository
helps interacting with
AuthorizationGrant
saved in the storage backend
Required Associated Types§
Required Methods§
sourcefn add<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
redirect_uri: Url,
scope: Scope,
code: Option<AuthorizationCode>,
state: Option<String>,
nonce: Option<String>,
max_age: Option<NonZeroU32>,
response_mode: ResponseMode,
response_type_id_token: bool,
requires_consent: bool,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, 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,
client: &'life3 Client,
redirect_uri: Url,
scope: Scope,
code: Option<AuthorizationCode>,
state: Option<String>,
nonce: Option<String>,
max_age: Option<NonZeroU32>,
response_mode: ResponseMode,
response_type_id_token: bool,
requires_consent: bool,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create a new authorization grant
Returns the newly created authorization grant
§Parameters
rng
: A random number generatorclock
: The clock used to generate timestampsclient
: The client that requested the authorization grantredirect_uri
: The redirect URI the client requestedscope
: The scope the client requestedcode
: The authorization code used by this grant, if thecode
response_type
was requestedstate
: The state the client sent, if setnonce
: The nonce the client sent, if setmax_age
: The maximum age since the user last authenticated, if asked by the clientresponse_mode
: The response mode the client requestedresponse_type_id_token
: Whether theid_token
response_type
was requestedrequires_consent
: Whether the client explicitly requested consent
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationGrant>, 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<AuthorizationGrant>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup an authorization grant by its ID
Returns the authorization grant if found, None
otherwise
§Parameters
id
: The ID of the authorization grant to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn find_by_code<'life0, 'life1, 'async_trait>(
&'life0 mut self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationGrant>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_code<'life0, 'life1, 'async_trait>(
&'life0 mut self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationGrant>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find an authorization grant by its code
Returns the authorization grant if found, None
otherwise
§Parameters
code
: The code of the authorization grant to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn fulfill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: &'life2 Session,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fulfill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: &'life2 Session,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fulfill an authorization grant, by giving the Session
that it
created
Returns the updated authorization grant
§Parameters
clock
: The clock used to generate timestampssession
: The session that was created using this authorization grantauthorization_grant
: The authorization grant to fulfill
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn exchange<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exchange<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Mark an authorization grant as exchanged
Returns the updated authorization grant
§Parameters
clock
: The clock used to generate timestampsauthorization_grant
: The authorization grant to mark as exchanged
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn give_consent<'life0, 'async_trait>(
&'life0 mut self,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn give_consent<'life0, 'async_trait>(
&'life0 mut self,
authorization_grant: AuthorizationGrant,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationGrant, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unset the requires_consent
flag on an authorization grant
Returns the updated authorization grant
§Parameters
authorization_grant
: The authorization grant to update
§Errors
Returns Self::Error
if the underlying repository fails