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§

source

type Error

The error type returned by the repository

Required Methods§

source

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 generator
  • clock: The clock used to generate timestamps
  • client: The client that requested the authorization grant
  • redirect_uri: The redirect URI the client requested
  • scope: The scope the client requested
  • code: The authorization code used by this grant, if the code response_type was requested
  • state: The state the client sent, if set
  • nonce: The nonce the client sent, if set
  • max_age: The maximum age since the user last authenticated, if asked by the client
  • response_mode: The response mode the client requested
  • response_type_id_token: Whether the id_token response_type was requested
  • requires_consent: Whether the client explicitly requested consent
§Errors

Returns Self::Error if the underlying repository fails

source

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

source

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

source

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 timestamps
  • session: The session that was created using this authorization grant
  • authorization_grant: The authorization grant to fulfill
§Errors

Returns Self::Error if the underlying repository fails

source

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 timestamps
  • authorization_grant: The authorization grant to mark as exchanged
§Errors

Returns Self::Error if the underlying repository fails

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

Implementations on Foreign Types§

source§

impl<R> OAuth2AuthorizationGrantRepository for Box<R>

§

type Error = <R as OAuth2AuthorizationGrantRepository>::Error

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

Implementors§