pub struct ApiKeyLayer<V> { /* private fields */ }Expand description
Tower Layer for API key validation.
If the configured header is absent, the request is rejected unless
ApiKeyLayer::accept_missing is enabled.
If present but invalid, returns 401.
Implementations§
Source§impl<V: KeyValidator + 'static> ApiKeyLayer<V>
impl<V: KeyValidator + 'static> ApiKeyLayer<V>
Sourcepub fn with_header(self, name: HeaderName) -> Self
pub fn with_header(self, name: HeaderName) -> Self
Override the header name used for key extraction.
Sourcepub const fn accept_missing(self) -> Self
pub const fn accept_missing(self) -> Self
Explicitly accept requests with no API-key header.
Trait Implementations§
Source§impl<V: Clone> Clone for ApiKeyLayer<V>
impl<V: Clone> Clone for ApiKeyLayer<V>
Source§fn clone(&self) -> ApiKeyLayer<V>
fn clone(&self) -> ApiKeyLayer<V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<V> !Freeze for ApiKeyLayer<V>
impl<V> RefUnwindSafe for ApiKeyLayer<V>where
V: RefUnwindSafe,
impl<V> Send for ApiKeyLayer<V>
impl<V> Sync for ApiKeyLayer<V>
impl<V> Unpin for ApiKeyLayer<V>
impl<V> UnsafeUnpin for ApiKeyLayer<V>
impl<V> UnwindSafe for ApiKeyLayer<V>where
V: RefUnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more