pub struct AuthValidator { /* private fields */ }Expand description
Authentication validator
Implementations§
Source§impl AuthValidator
impl AuthValidator
Sourcepub fn add_user(
&mut self,
username: impl Into<String>,
password: impl Into<String>,
)
pub fn add_user( &mut self, username: impl Into<String>, password: impl Into<String>, )
Add a user
Sourcepub fn add_protected_path(&mut self, path: impl Into<String>)
pub fn add_protected_path(&mut self, path: impl Into<String>)
Add a protected path
Sourcepub fn requires_auth(&self, path: &str) -> bool
pub fn requires_auth(&self, path: &str) -> bool
Check if path requires authentication
Sourcepub fn validate(&self, credentials: &Credentials) -> bool
pub fn validate(&self, credentials: &Credentials) -> bool
Validate credentials
Sourcepub fn user_count(&self) -> usize
pub fn user_count(&self) -> usize
Get user count
Sourcepub fn protected_path_count(&self) -> usize
pub fn protected_path_count(&self) -> usize
Get protected paths count
Sourcepub fn clear_users(&mut self)
pub fn clear_users(&mut self)
Clear all users
Sourcepub fn clear_paths(&mut self)
pub fn clear_paths(&mut self)
Clear all protected paths
Sourcepub fn remove_user(&mut self, username: &str) -> bool
pub fn remove_user(&mut self, username: &str) -> bool
Remove a user
Trait Implementations§
Source§impl Clone for AuthValidator
impl Clone for AuthValidator
Source§fn clone(&self) -> AuthValidator
fn clone(&self) -> AuthValidator
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 AuthValidator
impl Debug for AuthValidator
Auto Trait Implementations§
impl Freeze for AuthValidator
impl RefUnwindSafe for AuthValidator
impl Send for AuthValidator
impl Sync for AuthValidator
impl Unpin for AuthValidator
impl UnsafeUnpin for AuthValidator
impl UnwindSafe for AuthValidator
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