pub struct ApiKeyValidator { /* private fields */ }Expand description
API key validator
Implementations§
Source§impl ApiKeyValidator
impl ApiKeyValidator
Sourcepub fn add_api_key(
&mut self,
api_key: &str,
user_id: String,
) -> SecurityResult<()>
pub fn add_api_key( &mut self, api_key: &str, user_id: String, ) -> SecurityResult<()>
Add an API key (stores the hash)
Sourcepub fn validate_api_key(&self, api_key: &str) -> SecurityResult<String>
pub fn validate_api_key(&self, api_key: &str) -> SecurityResult<String>
Validate an API key and return the user ID
Sourcepub fn remove_api_key(&mut self, api_key: &str) -> SecurityResult<bool>
pub fn remove_api_key(&mut self, api_key: &str) -> SecurityResult<bool>
Remove an API key
Trait Implementations§
Source§impl Clone for ApiKeyValidator
impl Clone for ApiKeyValidator
Source§fn clone(&self) -> ApiKeyValidator
fn clone(&self) -> ApiKeyValidator
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 moreSource§impl Debug for ApiKeyValidator
impl Debug for ApiKeyValidator
Auto Trait Implementations§
impl Freeze for ApiKeyValidator
impl RefUnwindSafe for ApiKeyValidator
impl Send for ApiKeyValidator
impl Sync for ApiKeyValidator
impl Unpin for ApiKeyValidator
impl UnwindSafe for ApiKeyValidator
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