Skip to main content

Crate authen

Crate authen 

Source
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 postgres feature).
  • Web Integration: Axum-based web server integration (enable with web feature).

§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 (requires postgres feature).
  • [web_axum]: Axum web integration (requires web feature).

§Re-exports

  • AuthService: Main authentication service.
  • AuthenUser: User type.
  • AuthError: Error type.
  • [get_authen_axum_router], [start_server]: Web server utilities (with web feature).

§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.