pub struct MemoryAuthenticator { /* private fields */ }Expand description
In-memory user store for authentication.
§Spring Security Equivalent
InMemoryUserDetailsManager
§Example
ⓘ
use actix_security_core::http::security::{AuthenticationManager, User};
use actix_security_core::http::security::crypto::Argon2PasswordEncoder;
let encoder = Argon2PasswordEncoder::new();
let authenticator = AuthenticationManager::in_memory_authentication()
.password_encoder(encoder.clone())
.with_user(
User::with_encoded_password("admin", encoder.encode("secret"))
.roles(&["ADMIN".into()])
);Implementations§
Source§impl MemoryAuthenticator
impl MemoryAuthenticator
Sourcepub fn new() -> MemoryAuthenticator
pub fn new() -> MemoryAuthenticator
Creates a new in-memory authenticator with no users.
Sourcepub fn password_encoder<E>(self, encoder: E) -> MemoryAuthenticatorwhere
E: PasswordEncoder + 'static,
pub fn password_encoder<E>(self, encoder: E) -> MemoryAuthenticatorwhere
E: PasswordEncoder + 'static,
Sourcepub fn with_user(self, user: User) -> MemoryAuthenticator
pub fn with_user(self, user: User) -> MemoryAuthenticator
Trait Implementations§
Source§impl Authenticator for MemoryAuthenticator
impl Authenticator for MemoryAuthenticator
Source§impl Clone for MemoryAuthenticator
impl Clone for MemoryAuthenticator
Source§fn clone(&self) -> MemoryAuthenticator
fn clone(&self) -> MemoryAuthenticator
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 Default for MemoryAuthenticator
impl Default for MemoryAuthenticator
Source§fn default() -> MemoryAuthenticator
fn default() -> MemoryAuthenticator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryAuthenticator
impl !RefUnwindSafe for MemoryAuthenticator
impl Send for MemoryAuthenticator
impl Sync for MemoryAuthenticator
impl Unpin for MemoryAuthenticator
impl !UnwindSafe for MemoryAuthenticator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more