1use crate::{AuthError, AuthResult};
3use async_trait::async_trait;
4use serde::{Deserialize, Serialize};
5#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
6#[serde(rename_all = "camelCase")]
7pub struct SsoProvider {
8 pub id: String,
9 pub issuer: String,
10 pub domain: String,
11 pub provider_id: String,
12 pub user_id: Option<String>,
13 pub organization_id: Option<String>,
14 pub oidc_config: Option<String>,
15 pub saml_config: Option<String>,
16 pub domain_verified: Option<bool>,
17}
18#[async_trait]
19pub trait SsoProviderStore: Send + Sync {
20 async fn list_sso_providers(&self) -> AuthResult<Vec<SsoProvider>> {
21 Err(AuthError::config(
22 "SSO persistence is not supported by this store",
23 ))
24 }
25 async fn create_sso_provider(&self, _provider: SsoProvider) -> AuthResult<SsoProvider> {
26 Err(AuthError::config(
27 "SSO persistence is not supported by this store",
28 ))
29 }
30 async fn get_sso_provider(&self, _provider_id: &str) -> AuthResult<Option<SsoProvider>> {
31 Err(AuthError::config(
32 "SSO persistence is not supported by this store",
33 ))
34 }
35 async fn list_sso_providers_by_user(&self, _user_id: &str) -> AuthResult<Vec<SsoProvider>> {
36 Err(AuthError::config(
37 "SSO persistence is not supported by this store",
38 ))
39 }
40}