     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15

    use std::fmt::{Debug, Display};

    use actix_web::http::header::{HeaderValue, TryIntoHeaderValue};

    pub mod basic;
    pub mod bearer;

    use crate::headers::authorization::errors::ParseError;

    /// Authentication scheme for [`Authorization`](./struct.Authorization.html)
    /// header.
    pub trait Scheme: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync {
        /// Try to parse the authentication scheme from the `Authorization` header.
        fn parse(header: &HeaderValue) -> Result<Self, ParseError>;
    }