Authfix
Authentication layer for Actix-Web
This library offers an authentication middleware for Actix Web. It's easy to use and quick to set up.
Currently it provides session-based authentication built on actix-session, but you can implement your own AuthenticationProvider if needed. A provider for OIDC is planned for v0.2.0.
It supports multi-factor authentication.
- TOTP (e.g., Google or Microsoft Authenticator) with the ability to generate a QR code for securely sharing the secret with the user.
- Code sender mechanism that can deliver the code to the user via SMS, E-Mail, or other channels.
- Easy to extend, just implement the
Factortrait.
Examples
Example Repository
Check out the examples repo for detailed and working examples: Authfix examples
With default config (every route is secured)
use ;
use ;
use ;
// A user intended for session authentication must derive Serialize, and Deserialize.
// AccountInfo trait is used for disabling the user or to lock the account
// The user is enabled by default
// Struct that handles the authentication
;
// LoadUsersByCredentials uses async_trait, so its needed when implementing the trait for AuthenticationService
// async_trait is re-exported by authfix.
// You have access to the user via the AuthToken extractor in secured routes.
async
async
Add a public route
async
async