pub struct AzuriomAuth { /* private fields */ }Expand description
Azuriom authenticator
Authenticates users via an Azuriom CMS instance.
§Example
use lighty_auth::azuriom::AzuriomAuth;
use lighty_auth::Authenticator;
#[tokio::main]
async fn main() {
let mut auth = AzuriomAuth::new(
"https://example.com",
"user@example.com",
"password123"
);
let profile = auth.authenticate().await.unwrap();
println!("Logged in as: {}", profile.username);
}Implementations§
Source§impl AzuriomAuth
impl AzuriomAuth
Sourcepub fn new(
base_url: impl Into<String>,
email: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn new( base_url: impl Into<String>, email: impl Into<String>, password: impl Into<String>, ) -> Self
Create a new Azuriom authenticator
§Arguments
base_url: Base URL of the Azuriom instance (e.g., “https://example.com”)email: User email addresspassword: User password
Sourcepub fn set_two_factor_code(&mut self, code: impl Into<String>)
pub fn set_two_factor_code(&mut self, code: impl Into<String>)
Set the 2FA code (call this if authentication returns TwoFactorRequired)
§Arguments
code: The 2FA code from the authenticator app
Sourcepub fn clear_two_factor_code(&mut self)
pub fn clear_two_factor_code(&mut self)
Clear the 2FA code
Trait Implementations§
Source§impl Authenticator for AzuriomAuth
impl Authenticator for AzuriomAuth
Source§async fn authenticate(&mut self) -> AuthResult<UserProfile>
async fn authenticate(&mut self) -> AuthResult<UserProfile>
Authenticate a user and return their profile Read more
Source§async fn verify(&self, token: &str) -> AuthResult<UserProfile>
async fn verify(&self, token: &str) -> AuthResult<UserProfile>
Verify if a token is still valid Read more
Auto Trait Implementations§
impl Freeze for AzuriomAuth
impl RefUnwindSafe for AzuriomAuth
impl Send for AzuriomAuth
impl Sync for AzuriomAuth
impl Unpin for AzuriomAuth
impl UnwindSafe for AzuriomAuth
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more