Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required methods
    fn scheme(&self) -> AuthScheme;
    fn build_authorization_header(
        &self,
        challenge: &AuthChallenge,
    ) -> Result<String>;
}
Expand description

Trait for HTTP authentication providers.

Implementations of this trait handle the construction of Authorization headers based on server challenges. Both Basic and Digest authentication implement this trait.

Required Methods§

Source

fn scheme(&self) -> AuthScheme

Returns the authentication scheme this provider implements.

Source

fn build_authorization_header( &self, challenge: &AuthChallenge, ) -> Result<String>

Builds an Authorization header value based on the server’s challenge.

§Arguments
  • challenge - The authentication challenge from the WWW-Authenticate header
§Returns

A complete Authorization header value (e.g., “Basic xxx” or “Digest …”)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§