pub trait OAuth2DeviceCodeGrantRepository: 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,
        params: OAuth2DeviceCodeGrantParams<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, 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<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_device_code<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        device_code: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_user_code<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        user_code: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, 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,
        device_code_grant: DeviceCodeGrant,
        browser_session: &'life2 BrowserSession,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn reject<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        device_code_grant: DeviceCodeGrant,
        browser_session: &'life2 BrowserSession,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn exchange<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        device_code_grant: DeviceCodeGrant,
        session: &'life2 Session,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

An OAuth2DeviceCodeGrantRepository helps interacting with [DeviceCodeGrant] 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, params: OAuth2DeviceCodeGrantParams<'life3>, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new device code grant

Returns the newly created device code grant

§Parameters
  • rng: A random number generator
  • clock: The clock used to generate timestamps
  • params: The parameters used to create the device code grant. See the fields of OAuth2DeviceCodeGrantParams
§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<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup a device code grant by its ID

Returns the device code grant if found, None otherwise

§Parameters
  • id: The ID of the device code grant
§Errors

Returns Self::Error if the underlying repository fails

source

fn find_by_device_code<'life0, 'life1, 'async_trait>( &'life0 mut self, device_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lookup a device code grant by its device code

Returns the device code grant if found, None otherwise

§Parameters
  • device_code: The device code of the device code grant
§Errors

Returns Self::Error if the underlying repository fails

source

fn find_by_user_code<'life0, 'life1, 'async_trait>( &'life0 mut self, user_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lookup a device code grant by its user code

Returns the device code grant if found, None otherwise

§Parameters
  • user_code: The user code of the device code grant
§Errors

Returns Self::Error if the underlying repository fails

source

fn fulfill<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, device_code_grant: DeviceCodeGrant, browser_session: &'life2 BrowserSession, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark the device code grant as fulfilled with the given browser session

Returns the updated device code grant

§Parameters
  • clock: The clock used to generate timestamps
  • device_code_grant: The device code grant to fulfill
  • browser_session: The browser session which was used to fulfill the device code grant
§Errors

Returns Self::Error if the underlying repository fails or if the device code grant is not in the Pending state

source

fn reject<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, device_code_grant: DeviceCodeGrant, browser_session: &'life2 BrowserSession, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark the device code grant as rejected with the given browser session

Returns the updated device code grant

§Parameters
  • clock: The clock used to generate timestamps
  • device_code_grant: The device code grant to reject
  • browser_session: The browser session which was used to reject the device code grant
§Errors

Returns Self::Error if the underlying repository fails or if the device code grant is not in the Pending state

source

fn exchange<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, device_code_grant: DeviceCodeGrant, session: &'life2 Session, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark the device code grant as exchanged and store the session which was created

Returns the updated device code grant

§Parameters
  • clock: The clock used to generate timestamps
  • device_code_grant: The device code grant to exchange
  • session: The OAuth 2.0 session which was created
§Errors

Returns Self::Error if the underlying repository fails or if the device code grant is not in the Fulfilled state

Implementations on Foreign Types§

source§

impl<R> OAuth2DeviceCodeGrantRepository for Box<R>

§

type Error = <R as OAuth2DeviceCodeGrantRepository>::Error

source§

fn add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, params: OAuth2DeviceCodeGrantParams<'life3>, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, 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<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn find_by_device_code<'life0, 'life1, 'async_trait>( &'life0 mut self, device_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn find_by_user_code<'life0, 'life1, 'async_trait>( &'life0 mut self, user_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCodeGrant>, 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, device_code_grant: DeviceCodeGrant, browser_session: &'life2 BrowserSession, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn reject<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, device_code_grant: DeviceCodeGrant, browser_session: &'life2 BrowserSession, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

fn exchange<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, device_code_grant: DeviceCodeGrant, session: &'life2 Session, ) -> Pin<Box<dyn Future<Output = Result<DeviceCodeGrant, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Implementors§