Struct AddAuthorizationLayer
pub struct AddAuthorizationLayer { /* private fields */ }
Expand description
Layer that applies AddAuthorization
which adds authorization to all requests using the
Authorization
header.
See the module docs for an example.
You can also use SetRequestHeader
if you have a use case that isn’t supported by this
middleware.
Implementations§
§impl AddAuthorizationLayer
impl AddAuthorizationLayer
pub fn none() -> AddAuthorizationLayer
pub fn none() -> AddAuthorizationLayer
Create a new AddAuthorizationLayer
that does not add any authorization.
Can be useful if you only want to add authorization for some branches of your service.
pub fn new(credential: impl Credentials) -> AddAuthorizationLayer
pub fn new(credential: impl Credentials) -> AddAuthorizationLayer
Authorize requests using the given Credentials
.
pub fn as_sensitive(self, sensitive: bool) -> AddAuthorizationLayer
pub fn as_sensitive(self, sensitive: bool) -> AddAuthorizationLayer
Mark the header as sensitive.
This can for example be used to hide the header value from logs.
pub fn set_as_sensitive(
&mut self,
sensitive: bool,
) -> &mut AddAuthorizationLayer
pub fn set_as_sensitive( &mut self, sensitive: bool, ) -> &mut AddAuthorizationLayer
Mark the header as sensitive.
This can for example be used to hide the header value from logs.
pub fn if_not_present(self, value: bool) -> AddAuthorizationLayer
pub fn if_not_present(self, value: bool) -> AddAuthorizationLayer
Preserve the existing Authorization
header if it exists.
This can be useful if you want to use different authorization headers for different requests.
pub fn set_if_not_present(&mut self, value: bool) -> &mut AddAuthorizationLayer
pub fn set_if_not_present(&mut self, value: bool) -> &mut AddAuthorizationLayer
Preserve the existing Authorization
header if it exists.
This can be useful if you want to use different authorization headers for different requests.
Trait Implementations§
§impl Clone for AddAuthorizationLayer
impl Clone for AddAuthorizationLayer
§fn clone(&self) -> AddAuthorizationLayer
fn clone(&self) -> AddAuthorizationLayer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for AddAuthorizationLayer
impl Debug for AddAuthorizationLayer
§impl<S> Layer<S> for AddAuthorizationLayer
impl<S> Layer<S> for AddAuthorizationLayer
§type Service = AddAuthorization<S>
type Service = AddAuthorization<S>
§fn layer(&self, inner: S) -> <AddAuthorizationLayer as Layer<S>>::Service
fn layer(&self, inner: S) -> <AddAuthorizationLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <AddAuthorizationLayer as Layer<S>>::Service
fn into_layer(self, inner: S) -> <AddAuthorizationLayer as Layer<S>>::Service
layer
but consuming self after the service was created. Read moreAuto Trait Implementations§
impl !Freeze for AddAuthorizationLayer
impl RefUnwindSafe for AddAuthorizationLayer
impl Send for AddAuthorizationLayer
impl Sync for AddAuthorizationLayer
impl Unpin for AddAuthorizationLayer
impl UnwindSafe for AddAuthorizationLayer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more