securitydept_oidc_client/pending_store/
base.rs1use serde::Deserialize;
2
3use crate::OidcResult;
4
5#[derive(Clone)]
8pub struct PendingOauth {
9 pub nonce: String,
10 pub code_verifier: Option<String>,
11 pub extra_data: Option<serde_json::Value>,
12}
13
14pub trait PendingOauthStoreConfig:
15 Sized + for<'de> Deserialize<'de> + Clone + Default + Send + Sync
16{
17}
18
19pub trait PendingOauthStore: Sized + Send + Sync {
20 type Config: PendingOauthStoreConfig;
21
22 fn from_config(config: &Self::Config) -> Self;
23 fn from_config_opt(config_opt: Option<&Self::Config>) -> Self {
24 if let Some(config) = config_opt {
25 Self::from_config(config)
26 } else {
27 Self::from_config(&Self::Config::default())
28 }
29 }
30 fn insert(
33 &self,
34 state: String,
35 nonce: String,
36 code_verifier: Option<String>,
37 extra_data: Option<serde_json::Value>,
38 ) -> impl Future<Output = OidcResult<()>> + Send;
39 fn take(&self, state: &str) -> impl Future<Output = OidcResult<Option<PendingOauth>>> + Send;
42}