pub struct AuthFramework { /* private fields */ }
Expand description
Main authentication framework - now focused and modular
Implementations§
Source§impl AuthFramework
impl AuthFramework
Sourcepub fn new(config: AuthConfig) -> Self
pub fn new(config: AuthConfig) -> Self
Create a new authentication framework
Sourcepub fn register_method(
&mut self,
name: impl Into<String>,
method: AuthMethodEnum,
)
pub fn register_method( &mut self, name: impl Into<String>, method: AuthMethodEnum, )
Register an authentication method
Sourcepub async fn initialize(&mut self) -> Result<()>
pub async fn initialize(&mut self) -> Result<()>
Initialize the authentication framework
Sourcepub async fn authenticate(
&self,
method_name: &str,
credential: Credential,
) -> Result<AuthResult>
pub async fn authenticate( &self, method_name: &str, credential: Credential, ) -> Result<AuthResult>
Authenticate a user with the specified method
Sourcepub async fn authenticate_with_metadata(
&self,
method_name: &str,
credential: Credential,
metadata: CredentialMetadata,
) -> Result<AuthResult>
pub async fn authenticate_with_metadata( &self, method_name: &str, credential: Credential, metadata: CredentialMetadata, ) -> Result<AuthResult>
Authenticate a user with the specified method and metadata
Sourcepub async fn complete_mfa(
&self,
challenge: MfaChallenge,
mfa_code: &str,
) -> Result<AuthToken>
pub async fn complete_mfa( &self, challenge: MfaChallenge, mfa_code: &str, ) -> Result<AuthToken>
Complete multi-factor authentication
Sourcepub async fn validate_token(&self, token: &AuthToken) -> Result<bool>
pub async fn validate_token(&self, token: &AuthToken) -> Result<bool>
Validate a token
Sourcepub async fn get_user_info(&self, token: &AuthToken) -> Result<UserInfo>
pub async fn get_user_info(&self, token: &AuthToken) -> Result<UserInfo>
Get user information from a token
Sourcepub async fn check_permission(
&self,
token: &AuthToken,
action: &str,
resource: &str,
) -> Result<bool>
pub async fn check_permission( &self, token: &AuthToken, action: &str, resource: &str, ) -> Result<bool>
Check if a token has a specific permission
Sourcepub fn token_manager(&self) -> &TokenManager
pub fn token_manager(&self) -> &TokenManager
Get the token manager
Sourcepub fn mfa_manager(&self) -> &MfaManager
pub fn mfa_manager(&self) -> &MfaManager
Get the MFA manager
Sourcepub fn session_manager(&self) -> &SessionManager
pub fn session_manager(&self) -> &SessionManager
Get the session manager
Sourcepub fn user_manager(&self) -> &UserManager
pub fn user_manager(&self) -> &UserManager
Get the user manager
Sourcepub async fn initiate_sms_challenge(&self, user_id: &str) -> Result<String>
pub async fn initiate_sms_challenge(&self, user_id: &str) -> Result<String>
Initiate SMS challenge (uses SMSKit)
Sourcepub async fn send_sms_code(
&self,
challenge_id: &str,
phone_number: &str,
) -> Result<()>
pub async fn send_sms_code( &self, challenge_id: &str, phone_number: &str, ) -> Result<()>
Send SMS code (uses SMSKit)
Sourcepub async fn generate_sms_code(&self, challenge_id: &str) -> Result<String>
pub async fn generate_sms_code(&self, challenge_id: &str) -> Result<String>
Generate SMS code (uses SMSKit)
Sourcepub async fn verify_sms_code(
&self,
challenge_id: &str,
code: &str,
) -> Result<bool>
pub async fn verify_sms_code( &self, challenge_id: &str, code: &str, ) -> Result<bool>
Verify SMS code (uses SMSKit)
Sourcepub async fn cleanup_expired_data(&self) -> Result<()>
pub async fn cleanup_expired_data(&self) -> Result<()>
Clean up expired data
Auto Trait Implementations§
impl Freeze for AuthFramework
impl !RefUnwindSafe for AuthFramework
impl Send for AuthFramework
impl Sync for AuthFramework
impl Unpin for AuthFramework
impl !UnwindSafe for AuthFramework
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