pub struct UserManager { /* private fields */ }
Expand description
User manager for handling user operations
Implementations§
Source§impl UserManager
impl UserManager
Sourcepub fn new(storage: Arc<dyn AuthStorage>) -> Self
pub fn new(storage: Arc<dyn AuthStorage>) -> Self
Create a new user manager
Sourcepub async fn create_api_key(
&self,
user_id: &str,
expires_in: Option<Duration>,
) -> Result<String>
pub async fn create_api_key( &self, user_id: &str, expires_in: Option<Duration>, ) -> Result<String>
Create API key for a user
Sourcepub async fn validate_api_key(&self, api_key: &str) -> Result<UserInfo>
pub async fn validate_api_key(&self, api_key: &str) -> Result<UserInfo>
Validate API key and return user information
Sourcepub async fn revoke_api_key(&self, api_key: &str) -> Result<()>
pub async fn revoke_api_key(&self, api_key: &str) -> Result<()>
Revoke API key
Sourcepub async fn validate_username(&self, username: &str) -> Result<bool>
pub async fn validate_username(&self, username: &str) -> Result<bool>
Validate username format
Sourcepub async fn validate_display_name(&self, display_name: &str) -> Result<bool>
pub async fn validate_display_name(&self, display_name: &str) -> Result<bool>
Validate display name format
Sourcepub async fn validate_password_strength(&self, password: &str) -> Result<bool>
pub async fn validate_password_strength(&self, password: &str) -> Result<bool>
Validate password strength using security policy
Sourcepub async fn validate_user_input(&self, input: &str) -> Result<bool>
pub async fn validate_user_input(&self, input: &str) -> Result<bool>
Validate user input for security
Sourcepub async fn map_user_attribute(
&self,
user_id: &str,
attribute: &str,
value: &str,
) -> Result<()>
pub async fn map_user_attribute( &self, user_id: &str, attribute: &str, value: &str, ) -> Result<()>
Map user attribute
Sourcepub async fn get_user_attribute(
&self,
user_id: &str,
attribute: &str,
) -> Result<Option<String>>
pub async fn get_user_attribute( &self, user_id: &str, attribute: &str, ) -> Result<Option<String>>
Get user attribute
Sourcepub async fn get_user_info(&self, user_id: &str) -> Result<UserInfo>
pub async fn get_user_info(&self, user_id: &str) -> Result<UserInfo>
Get user information by ID
Sourcepub async fn user_exists(&self, user_id: &str) -> Result<bool>
pub async fn user_exists(&self, user_id: &str) -> Result<bool>
Check if user exists
Auto Trait Implementations§
impl Freeze for UserManager
impl !RefUnwindSafe for UserManager
impl Send for UserManager
impl Sync for UserManager
impl Unpin for UserManager
impl !UnwindSafe for UserManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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 more