Skip to main content

AuthenticationProvider

Trait AuthenticationProvider 

Source
pub trait AuthenticationProvider: Send + Sync {
    type Context: AuthenticationContext;

    // Required methods
    async fn initialize(
        &mut self,
        config: AuthConfig,
        metadata_service: Option<Arc<dyn Any + Send + Sync>>,
    ) -> AuthServiceResult<()>;
    async fn authenticate(
        &self,
        context: &Self::Context,
    ) -> AuthServiceResult<()>;
    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;
}
Expand description

Authentication provider trait.

Required Associated Types§

Source

type Context: AuthenticationContext

Associated authentication context type.

Required Methods§

Source

async fn initialize( &mut self, config: AuthConfig, metadata_service: Option<Arc<dyn Any + Send + Sync>>, ) -> AuthServiceResult<()>

Initialize the provider.

Source

async fn authenticate(&self, context: &Self::Context) -> AuthServiceResult<()>

Authenticate a request.

Source

fn new_context_from_metadata( &self, metadata: &HashMap<String, String>, request: Box<dyn Any + Send>, ) -> Self::Context

Create context from gRPC metadata.

Source

fn new_context_from_command(&self, command: &RemotingCommand) -> Self::Context

Create context from remoting command.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§