Skip to main content

DeviceCodeStore

Trait DeviceCodeStore 

Source
pub trait DeviceCodeStore: Send + Sync {
    // Required methods
    fn create_device_code<'life0, 'async_trait>(
        &'life0 self,
        input: CreateDeviceCode,
    ) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_device_code_by_device_code<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_code: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_device_code_by_user_code<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_code: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_device_code<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        update: UpdateDeviceCode,
    ) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_device_code_if_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        current_status: &'life2 str,
        update: UpdateDeviceCode,
    ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn claim_device_code<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        user_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_device_code<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_device_code_if_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        status: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Persistence for OAuth device authorization codes.

Required Methods§

Source

fn create_device_code<'life0, 'async_trait>( &'life0 self, input: CreateDeviceCode, ) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist a newly-issued device code.

Source

fn get_device_code_by_device_code<'life0, 'life1, 'async_trait>( &'life0 self, device_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a device code by its opaque device-facing token.

Source

fn get_device_code_by_user_code<'life0, 'life1, 'async_trait>( &'life0 self, user_code: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a device code by its user-facing verification code.

Source

fn update_device_code<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, update: UpdateDeviceCode, ) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update mutable device-code state such as approval status or poll time.

Source

fn update_device_code_if_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, current_status: &'life2 str, update: UpdateDeviceCode, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update a device code only when it still has the expected status.

Returns true when the compare-and-swap succeeds, or false when the row was already moved to a different state.

Source

fn claim_device_code<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, user_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Bind a still-pending, still-unclaimed device code to a user.

Returns true when this call performed the claim, and false when the row was already claimed or no longer pending. The status and unclaimed checks are part of the write so two concurrent verifiers cannot both claim the same code.

Source

fn delete_device_code<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a device code record.

Source

fn delete_device_code_if_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, status: &'life2 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a device code only when it still has the expected status.

Returns true when a matching row was deleted and false otherwise.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§