use std::any::Any;
use std::collections::HashMap;
use std::sync::Arc;
use rocketmq_error::RocketMQResult;
use rocketmq_remoting::protocol::remoting_command::RemotingCommand;
use crate::authorization::context::authentication_context::AuthenticationContext;
use crate::config::AuthConfig;
#[allow(async_fn_in_trait)]
pub trait AuthenticationProvider: Send + Sync {
type Context: AuthenticationContext;
async fn initialize(
&mut self,
config: AuthConfig,
metadata_service: Option<Arc<dyn Any + Send + Sync>>,
) -> RocketMQResult<()>;
async fn authenticate(&self, context: &Self::Context) -> RocketMQResult<()>;
fn new_context_from_metadata(
&self,
metadata: &HashMap<String, String>,
request: Box<dyn Any + Send>,
) -> Self::Context;
fn new_context_from_command(&self, command: &RemotingCommand) -> Self::Context;
}