pub struct ApiKeyAuth { /* private fields */ }
Expand description
API key middleware, validates an API key is present and in the allow list.
Implementations§
Source§impl ApiKeyAuth
impl ApiKeyAuth
Sourcepub fn new(header: HeaderName, allowed_keys: Vec<String>) -> Self
pub fn new(header: HeaderName, allowed_keys: Vec<String>) -> Self
Create new API key authorization layer
Sourcepub fn new_layer(
header: HeaderName,
allowed_keys: Vec<String>,
) -> AsyncRequireAuthorizationLayer<Self>
pub fn new_layer( header: HeaderName, allowed_keys: Vec<String>, ) -> AsyncRequireAuthorizationLayer<Self>
Create a new AsyncRequireAuthorizationLayer
containing self.
Trait Implementations§
Source§impl<B> AsyncAuthorizeRequest<B> for ApiKeyAuth
impl<B> AsyncAuthorizeRequest<B> for ApiKeyAuth
Source§type RequestBody = B
type RequestBody = B
The type of request body returned by
authorize
. Read moreSource§type ResponseBody = Full<Bytes>
type ResponseBody = Full<Bytes>
The body type used for responses to unauthorized requests.
Source§type Future = Pin<Box<dyn Future<Output = Result<Request<B>, Response<<ApiKeyAuth as AsyncAuthorizeRequest<B>>::ResponseBody>>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<Request<B>, Response<<ApiKeyAuth as AsyncAuthorizeRequest<B>>::ResponseBody>>> + Send>>
The Future type returned by
authorize
Authorize the request. Read more
Source§impl Clone for ApiKeyAuth
impl Clone for ApiKeyAuth
Source§fn clone(&self) -> ApiKeyAuth
fn clone(&self) -> ApiKeyAuth
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for ApiKeyAuth
impl RefUnwindSafe for ApiKeyAuth
impl Send for ApiKeyAuth
impl Sync for ApiKeyAuth
impl Unpin for ApiKeyAuth
impl UnwindSafe for ApiKeyAuth
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