rama_http::headers::authorization

Trait Credentials

Source
pub trait Credentials: Sized {
    const SCHEME: &'static str;

    // Required methods
    fn decode(value: &HeaderValue) -> Option<Self>;
    fn encode(&self) -> HeaderValue;
}
Expand description

Credentials to be used in the Authorization header.

Required Associated Constants§

Source

const SCHEME: &'static str

The scheme identify the format of these credentials.

This is the static string that always prefixes the actual credentials, like "Basic" in basic authorization.

Required Methods§

Source

fn decode(value: &HeaderValue) -> Option<Self>

Try to decode the credentials from the HeaderValue.

The SCHEME will be the first part of the value.

Source

fn encode(&self) -> HeaderValue

Encode the credentials to a HeaderValue.

The SCHEME must be the first part of the value.

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.

Implementations on Foreign Types§

Source§

impl Credentials for Basic

Available on crate feature http only.
Source§

const SCHEME: &'static str = BASIC_SCHEME

Source§

fn decode(value: &HeaderValue) -> Option<Basic>

Source§

fn encode(&self) -> HeaderValue

Source§

impl Credentials for Bearer

Available on crate feature http only.
Source§

const SCHEME: &'static str = BEARER_SCHEME

Source§

fn decode(value: &HeaderValue) -> Option<Bearer>

Source§

fn encode(&self) -> HeaderValue

Implementors§

Source§

impl Credentials for rama_http::headers::authorization::Basic

Source§

const SCHEME: &'static str = "Basic"

Source§

impl Credentials for rama_http::headers::authorization::Bearer

Source§

const SCHEME: &'static str = "Bearer"