pub struct MemoryAuthEngine { /* private fields */ }Expand description
In-memory authentication engine using a HashMap.
This is a simple authentication engine that stores credentials in memory. Useful for testing and simple deployments.
Implementations§
Source§impl MemoryAuthEngine
impl MemoryAuthEngine
Sourcepub fn from_map(credentials: HashMap<String, String>) -> Self
pub fn from_map(credentials: HashMap<String, String>) -> Self
Creates a MemoryAuthEngine from an existing HashMap.
Sourcepub fn from_arc(credentials: Arc<HashMap<String, String>>) -> Self
pub fn from_arc(credentials: Arc<HashMap<String, String>>) -> Self
Creates a MemoryAuthEngine from an Arc
Sourcepub fn from_file(path: &str) -> Result<Self>
pub fn from_file(path: &str) -> Result<Self>
Loads credentials from a file.
The file should be formatted as:
username:password
username2:password2Returns an error if the file cannot be read.
Trait Implementations§
Source§impl AuthEngine for MemoryAuthEngine
impl AuthEngine for MemoryAuthEngine
Source§fn authenticate(&self, username: &str, password: &str) -> AuthResult<()>
fn authenticate(&self, username: &str, password: &str) -> AuthResult<()>
Authenticates a user with the given username and password. Read more
Source§fn user_exists(&self, username: &str) -> AuthResult<bool>
fn user_exists(&self, username: &str) -> AuthResult<bool>
Checks if a user exists in the authentication store.
Source§impl Clone for MemoryAuthEngine
impl Clone for MemoryAuthEngine
Source§fn clone(&self) -> MemoryAuthEngine
fn clone(&self) -> MemoryAuthEngine
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 MemoryAuthEngine
impl Debug for MemoryAuthEngine
Auto Trait Implementations§
impl Freeze for MemoryAuthEngine
impl RefUnwindSafe for MemoryAuthEngine
impl Send for MemoryAuthEngine
impl Sync for MemoryAuthEngine
impl Unpin for MemoryAuthEngine
impl UnwindSafe for MemoryAuthEngine
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