Struct tower_http::auth::RequireAuthorizationLayer
source · pub struct RequireAuthorizationLayer<T> { /* private fields */ }
Available on crate feature
auth
only.Expand description
Layer that applies RequireAuthorization
which authorizes all requests using the
Authorization
header.
See the module docs for an example.
Implementations§
source§impl<ResBody> RequireAuthorizationLayer<Bearer<ResBody>>
impl<ResBody> RequireAuthorizationLayer<Bearer<ResBody>>
source§impl<ResBody> RequireAuthorizationLayer<Basic<ResBody>>
impl<ResBody> RequireAuthorizationLayer<Basic<ResBody>>
sourcepub fn basic(username: &str, password: &str) -> Selfwhere
ResBody: Body + Default,
pub fn basic(username: &str, password: &str) -> Selfwhere
ResBody: Body + Default,
Authorize requests using a username and password pair.
The Authorization
header is required to be Basic {credentials}
where credentials
is
base64_encode("{username}:{password}")
.
Since the username and password is sent in clear text it is recommended to use HTTPS/TLS with this method. However use of HTTPS/TLS is not enforced by this middleware.
source§impl<T> RequireAuthorizationLayer<T>
impl<T> RequireAuthorizationLayer<T>
sourcepub fn custom(auth: T) -> RequireAuthorizationLayer<T>
pub fn custom(auth: T) -> RequireAuthorizationLayer<T>
Authorize requests using a custom scheme.
Trait Implementations§
source§impl<T: Clone> Clone for RequireAuthorizationLayer<T>
impl<T: Clone> Clone for RequireAuthorizationLayer<T>
source§fn clone(&self) -> RequireAuthorizationLayer<T>
fn clone(&self) -> RequireAuthorizationLayer<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more