pub struct AuthService { /* private fields */ }Expand description
Authentication service for managing user authentication.
Provides password hashing, verification, and optional JWT token management.
§Examples
Basic password authentication:
use armature_auth::{AuthService, PasswordVerifier};
let service = AuthService::new();
// Hash password
let hash = service.hash_password("mypassword")?;
// Verify password
assert!(service.verify_password("mypassword", &hash)?);
assert!(!service.verify_password("wrongpassword", &hash)?);Implementations§
Source§impl AuthService
impl AuthService
Sourcepub fn with_jwt(jwt_manager: JwtManager) -> Self
pub fn with_jwt(jwt_manager: JwtManager) -> Self
Create with JWT manager
Sourcepub fn with_password_hasher(self, hasher: PasswordHasher) -> Self
pub fn with_password_hasher(self, hasher: PasswordHasher) -> Self
Set password hasher
Sourcepub fn hash_password(&self, password: &str) -> Result<String>
pub fn hash_password(&self, password: &str) -> Result<String>
Hash a password
Sourcepub fn jwt_manager(&self) -> Option<&JwtManager>
pub fn jwt_manager(&self) -> Option<&JwtManager>
Get JWT manager
Trait Implementations§
Source§impl Clone for AuthService
impl Clone for AuthService
Source§fn clone(&self) -> AuthService
fn clone(&self) -> AuthService
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 moreAuto Trait Implementations§
impl Freeze for AuthService
impl RefUnwindSafe for AuthService
impl Send for AuthService
impl Sync for AuthService
impl Unpin for AuthService
impl UnwindSafe for AuthService
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> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging