pub struct AuthenticationManager { /* private fields */ }
Expand description
Authentication manager for handling user authentication and sessions
Implementations§
Source§impl AuthenticationManager
impl AuthenticationManager
Sourcepub fn with_config(config: AuthConfig) -> Self
pub fn with_config(config: AuthConfig) -> Self
Create a new authentication manager with custom configuration
Sourcepub async fn register_user(
&self,
username: &str,
password: &str,
email: &str,
) -> Result<String, SyncError>
pub async fn register_user( &self, username: &str, password: &str, email: &str, ) -> Result<String, SyncError>
Register a new user
Sourcepub async fn login(
&self,
username: &str,
password: &str,
) -> Result<UserSession, SyncError>
pub async fn login( &self, username: &str, password: &str, ) -> Result<UserSession, SyncError>
Authenticate user with username and password
Sourcepub async fn login_with_mfa(
&self,
username: &str,
password: &str,
mfa_code: &str,
) -> Result<UserSession, SyncError>
pub async fn login_with_mfa( &self, username: &str, password: &str, mfa_code: &str, ) -> Result<UserSession, SyncError>
Authenticate user with MFA
Sourcepub async fn validate_session(&self, token: &str) -> Result<bool, SyncError>
pub async fn validate_session(&self, token: &str) -> Result<bool, SyncError>
Validate user session
Sourcepub async fn initiate_password_reset(
&self,
username: &str,
) -> Result<String, SyncError>
pub async fn initiate_password_reset( &self, username: &str, ) -> Result<String, SyncError>
Initiate password reset
Sourcepub async fn complete_password_reset(
&self,
token: &str,
new_password: &str,
) -> Result<(), SyncError>
pub async fn complete_password_reset( &self, token: &str, new_password: &str, ) -> Result<(), SyncError>
Complete password reset
Sourcepub async fn generate_mfa_code(
&self,
user_id: &str,
) -> Result<String, SyncError>
pub async fn generate_mfa_code( &self, user_id: &str, ) -> Result<String, SyncError>
Generate MFA code for user
Sourcepub async fn list_users(&self) -> Vec<User>
pub async fn list_users(&self) -> Vec<User>
List all users
Sourcepub async fn cleanup_expired_sessions(&self) -> usize
pub async fn cleanup_expired_sessions(&self) -> usize
Clean up expired sessions
Sourcepub async fn cleanup_expired_reset_tokens(&self) -> usize
pub async fn cleanup_expired_reset_tokens(&self) -> usize
Clean up expired reset tokens
Auto Trait Implementations§
impl !Freeze for AuthenticationManager
impl !RefUnwindSafe for AuthenticationManager
impl Send for AuthenticationManager
impl Sync for AuthenticationManager
impl Unpin for AuthenticationManager
impl !UnwindSafe for AuthenticationManager
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> 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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.