Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required methods
    fn scheme(&self) -> &str;
    fn authenticate(
        &self,
        credentials: &Credentials,
    ) -> Result<Principal, AuthError>;
}
Expand description

Authentication provider — AuthProvider::authenticate(creds) -> Principal.

Required Methods§

Source

fn scheme(&self) -> &str

Authentication scheme name ("basic", "bearer", "mtls").

Source

fn authenticate( &self, credentials: &Credentials, ) -> Result<Principal, AuthError>

Authenticate the given credentials.

§Errors

Returns AuthError if the credentials are invalid.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§