Trait AuthenticationExtension

Source
pub trait AuthenticationExtension: Sized + 'static {
    // Required methods
    fn new(config: Configuration) -> Result<Self, Error>;
    fn authenticate(
        &mut self,
        headers: &GatewayHeaders,
    ) -> Result<Token, ErrorResponse>;
}
Expand description

A trait that extends Extension and provides authentication functionality.

Required Methods§

Source

fn new(config: Configuration) -> Result<Self, Error>

Creates a new instance of the extension.

§Arguments
  • config - The configuration for this extension, from the gateway TOML.
§Returns

Returns an instance of this resolver. Upon failure, every call to this extension will fail.

Source

fn authenticate( &mut self, headers: &GatewayHeaders, ) -> Result<Token, ErrorResponse>

Authenticates the request using the provided headers.

§Arguments
  • headers - The request headers to authenticate with.
§Returns
  • Ok(Token) - A valid authentication token if successful.
  • Err(ErrorResponse) - An error response if authentication fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§