Crate humphrey_auth[][src]

Expand description



Authentication support for Humphrey.

Web applications commonly need a way of authenticating users. This crate provides an easy and secure way to do this, integrating with Humphrey using the AuthApp trait and allowing complete control over the database users are stored in. Humphrey Auth does not come with a database, but the AuthDatabase trait is implemented for Vec<User> to get started. For a production use, you should use a proper database and implement the AuthDatabase trait for it.

Note: unlike the other crates in the Humphrey ecosystem, Humphrey Auth does require some dependencies, since fully-secure implementations of several complex cryptographic algorithms are required.

Features

  • Configurable and secure authentication using the Argon2 algorithm, provided by the argon2 crate.
  • Flexible user storage, allowing the use of any database by simply implementing a trait.
  • Session and token management with a simple API.

Installation

The Humphrey Auth crate can be installed by adding humphrey_auth to your dependencies in your Cargo.toml file.

Documentation

The Humphrey Auth documentation can be found at docs.rs.

Example

A basic example of username/password authentication can be found here.

Modules

Provides the authentication-related extensions to the Humphrey app.

Contains configuration functionality for the authentication service.

Contains database traits for connecting the authentication service with a database of your choosing. These are automatically implemented for Vec<User> as an example.

Provides error handling capabilities to the crate.

Provides functionality for handling sessions and tokens.

Provides a user model for the authentication service.

Structs

Represents an authentication provider. Contains a database of users and provides methods for managing authentication.