rocketmq_auth/authentication/provider/
authentication_metadata_provider.rs1use std::any::Any;
18use std::future::Future;
19use std::pin::Pin;
20use std::sync::Arc;
21
22use crate::authentication::model::user::User;
23use crate::config::AuthConfig;
24use crate::AuthServiceResult;
25
26pub trait AuthenticationMetadataProvider: Send + Sync {
28 fn initialize<'a>(
30 &'a mut self,
31 config: AuthConfig,
32 metadata_service: Option<Arc<dyn Any + Send + Sync>>,
33 ) -> Pin<Box<dyn Future<Output = AuthServiceResult<()>> + Send + 'a>>;
34
35 fn shutdown(&mut self) -> Pin<Box<dyn Future<Output = AuthServiceResult<()>> + Send + '_>>;
37
38 fn create_user<'a>(&'a self, user: User) -> Pin<Box<dyn Future<Output = AuthServiceResult<()>> + Send + 'a>>;
40
41 fn delete_user<'a>(&'a self, username: &'a str)
43 -> Pin<Box<dyn Future<Output = AuthServiceResult<()>> + Send + 'a>>;
44
45 fn update_user<'a>(&'a self, user: User) -> Pin<Box<dyn Future<Output = AuthServiceResult<()>> + Send + 'a>>;
47
48 fn get_user<'a>(&'a self, username: &'a str) -> Pin<Box<dyn Future<Output = AuthServiceResult<User>> + Send + 'a>>;
50
51 fn list_user<'a>(
53 &'a self,
54 filter: Option<&'a str>,
55 ) -> Pin<Box<dyn Future<Output = AuthServiceResult<Vec<User>>> + Send + 'a>>;
56}