use async_trait::async_trait; use rustical_oidc::UserStore; use rustical_store::auth::{AuthenticationProvider, Principal, PrincipalType}; use std::sync::Arc; pub struct OidcUserStore(pub Arc); impl Clone for OidcUserStore { fn clone(&self) -> Self { Self(self.0.clone()) } } #[async_trait] impl UserStore for OidcUserStore { type Error = rustical_store::Error; async fn user_exists(&self, id: &str) -> Result { Ok(self.0.get_principal(id).await?.is_some()) } async fn insert_user(&self, id: &str) -> Result<(), Self::Error> { self.0 .insert_principal( Principal { id: id.to_owned(), displayname: None, principal_type: PrincipalType::default(), password: None, memberships: vec![], }, false, ) .await } }