use serde::Deserialize;
use crate::OidcResult;
#[derive(Clone)]
pub struct PendingOauth {
pub nonce: String,
pub code_verifier: Option<String>,
pub extra_data: Option<serde_json::Value>,
}
pub trait PendingOauthStoreConfig:
Sized + for<'de> Deserialize<'de> + Clone + Default + Send + Sync
{
}
pub trait PendingOauthStore: Sized + Send + Sync {
type Config: PendingOauthStoreConfig;
fn from_config(config: &Self::Config) -> Self;
fn from_config_opt(config_opt: Option<&Self::Config>) -> Self {
if let Some(config) = config_opt {
Self::from_config(config)
} else {
Self::from_config(&Self::Config::default())
}
}
fn insert(
&self,
state: String,
nonce: String,
code_verifier: Option<String>,
extra_data: Option<serde_json::Value>,
) -> impl Future<Output = OidcResult<()>> + Send;
fn take(&self, state: &str) -> impl Future<Output = OidcResult<Option<PendingOauth>>> + Send;
}