actix_quick_extract/headers/authorization.rs
1use actix_web::{http::header::AUTHORIZATION, FromRequest};
2use derive_more::{AsRef, Deref, Display, From, Into};
3/// The `Authorization` header.
4///
5/// No parsing is done on the header, it is simply returned as a string.
6///
7/// ```no_run
8/// use actix_quick_extract::headers::RawAuthorization;
9/// use actix_web::get;
10///
11/// #[get("/")]
12/// pub async fn index(auth: RawAuthorization) -> String {
13/// format!("Your auth Header is: {}", auth)
14/// }
15/// ```
16#[derive(Debug, Clone, PartialEq, Eq, Hash, Display, Into, AsRef, Deref, From)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18#[as_ref(str)]
19#[deref(forward)]
20#[repr(transparent)]
21pub struct RawAuthorization(pub String);
22
23super::simple_header!(RawAuthorization, AUTHORIZATION, "Authorization");