Expand description
§Authen Authentication Crate
authen is a robust and secure authentication library for Rust, designed to provide all the essential building blocks for modern authentication systems.
§Features
- User Management: Create, update, and manage user accounts with flexible persistence options.
- Password Hashing: Secure password storage using industry-standard algorithms (e.g., Argon2).
- Token Management: JWT-based access and refresh token generation, validation, and rotation.
- Session Handling: Tools for managing user sessions securely.
- Policy Enforcement: Password and authentication policy enforcement.
- Pluggable Backends: Support for in-memory and PostgreSQL backends (enable with
postgresfeature). - Web Integration: Axum-based web server integration (enable with
webfeature).
§Optional Features
postgres: Enables PostgreSQL-backed persistence.web: Enables Axum web server integration for HTTP APIs.
§Example
use authen::{AuthService, AuthenUser};
// ...§Modules
auth_service: High-level authentication service API.core: Core primitives (users, credentials, hashing, tokens, etc.).error: Error types for authentication operations.- [
postgres]: PostgreSQL backend (requirespostgresfeature). - [
web_axum]: Axum web integration (requireswebfeature).
§Re-exports
AuthService: Main authentication service.AuthenUser: User type.AuthError: Error type.- [
get_authen_axum_router], [start_server]: Web server utilities (withwebfeature).
§License
See LICENCE for details.
For more details, see the individual module documentation.
Re-exports§
pub use auth_service::AuthService;pub use auth_service::LoginMethod;pub use auth_service::SignupMethod;pub use core::user::User as AuthenUser;pub use error::AuthError;
Modules§
- auth_
service - High-level authentication service API.
- core
- Core primitives: users, credentials, hashing, tokens, etc.
- error
- Error types for authentication operations.