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§
Required Methods§
sourcefn 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 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 generatorclock
: The clock used to generate timestampsparams
: The parameters used to create the device code grant. See the fields ofOAuth2DeviceCodeGrantParams
§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<DeviceCodeGrant>, 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<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
sourcefn 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_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
sourcefn 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 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
sourcefn 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 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 timestampsdevice_code_grant
: The device code grant to fulfillbrowser_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
sourcefn 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 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 timestampsdevice_code_grant
: The device code grant to rejectbrowser_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
sourcefn 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,
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 timestampsdevice_code_grant
: The device code grant to exchangesession
: 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