Expand description
§lmrc-auth
Authentication framework for LMRC Stack applications.
This library provides a flexible authentication system with support for:
- Multiple authentication providers (database, LDAP, OAuth, etc.)
- Session management
- Password hashing
- Authentication middleware for Axum
- Ready-to-use HTTP handlers
§Features
bcrypt(default) - Password hashing with bcryptdatabase- Database-backed authentication provider with SeaORM
§Quick Start
ⓘ
use lmrc_auth::{AuthProvider, DatabaseAuthProvider, AuthConfig};
use sea_orm::Database;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db = Database::connect("postgres://localhost/mydb").await?;
let auth_provider = Arc::new(
DatabaseAuthProvider::new(
db,
"users",
"sessions",
AuthConfig::default()
)
);
// Use in your Axum application
Ok(())
}Re-exports§
pub use error::AuthError;pub use error::AuthResult;pub use models::AuthUser;pub use models::Credentials;pub use models::LoginResponse;pub use models::Session;pub use traits::AuthProvider;pub use traits::SessionStore;
Modules§
- error
- Authentication error types
- handlers
- HTTP handlers for authentication
- middleware
- Authentication middleware for Axum
- models
- Authentication data models
- traits
- Authentication trait definitions
Structs§
- Auth
Config - Authentication configuration