pub struct ApiKeyMiddleware { /* private fields */ }Expand description
API Key authentication middleware
Implementations§
Source§impl ApiKeyMiddleware
impl ApiKeyMiddleware
Sourcepub fn new(config: ApiKeyConfig) -> Self
pub fn new(config: ApiKeyConfig) -> Self
Create a new API Key middleware
Sourcepub fn validate_request(
&self,
headers: &HashMap<String, String>,
query_params: Option<&HashMap<String, String>>,
) -> bool
pub fn validate_request( &self, headers: &HashMap<String, String>, query_params: Option<&HashMap<String, String>>, ) -> bool
Sourcepub fn extract_key(
&self,
headers: &HashMap<String, String>,
query_params: Option<&HashMap<String, String>>,
) -> Option<String>
pub fn extract_key( &self, headers: &HashMap<String, String>, query_params: Option<&HashMap<String, String>>, ) -> Option<String>
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if authentication is enabled
Auto Trait Implementations§
impl Freeze for ApiKeyMiddleware
impl RefUnwindSafe for ApiKeyMiddleware
impl Send for ApiKeyMiddleware
impl Sync for ApiKeyMiddleware
impl Unpin for ApiKeyMiddleware
impl UnsafeUnpin for ApiKeyMiddleware
impl UnwindSafe for ApiKeyMiddleware
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