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;
// Provided methods
fn create_device_code_with_fields<'life0, 'async_trait>(
&'life0 self,
input: CreateDeviceCode,
fields: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn device_code_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Map<String, Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn consume_device_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_status: &'life2 str,
_ownership: &'life3 Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
Persistence for OAuth device authorization codes.
Required Methods§
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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<'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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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<'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.
Sourcefn 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,
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.
Provided Methods§
Sourcefn create_device_code_with_fields<'life0, 'async_trait>(
&'life0 self,
input: CreateDeviceCode,
fields: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_device_code_with_fields<'life0, 'async_trait>(
&'life0 self,
input: CreateDeviceCode,
fields: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<DeviceCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically persist a grant with application-owned fields.
Sourcefn device_code_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Map<String, Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn device_code_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Map<String, Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read the durable application fields belonging to a device record.
Sourcefn consume_device_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_status: &'life2 str,
_ownership: &'life3 Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn consume_device_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_status: &'life2 str,
_ownership: &'life3 Map<String, Value>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<DeviceCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Consume exactly one approved grant matching all application ownership predicates.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".