Crate autho

Source
Expand description

Web authentication library.

This crate provides authentication for web applications.

§Features

§Storage Backends

  • postgres: Enable PostgreSQL integration.

§Web Frameworks

  • axum: Enable Axum integration.

§Hash Algorithms

This library supports multiple hash algorithms but is currently configured to use only argon2. In the future, the list of supported hashing algorithms may change. Either because better algorithms are added, or because existing algorithms are found to be insecure. The default set always only includes safe algorithms.

However, to keep support for algorithms currently in use within your project, you can enable a specific hash-algorithm-vN feature. This forces the inclusion of older hashing algorithms, even if they maybe deemed less secure in the future. By doing this, you keep support for older hashing algorithms, and while also gaining increased security for new logins through the use of newer algorithms.

Note that only one of these features can be enabled; they are not additive.

New projects can simply pin the latest algorithm set version.

  • hash-algorithms-v1: argon2

Structs§

Authenticated
A compile-time token to prove authentication.
HashedPassword
A password that has been hashed.
Session
A user session.
SessionFields
The fields associated with session as stored by the backend.
SessionId
A unique identifier to associate a user with a session.
ValidPassword
A password that has been validated.

Enums§

BadPassword
The reason a password is considered invalid.

Constants§

MAX_PASSWORD_LENGTH
The maximum length of a password to be considered valid.
MIN_PASSWORD_LENGTH
The minimum length of a password to be considered valid.

Traits§

Backend
The interface for a backend.
CookieSessionBackend
The interface for a backend that stores the session id in a cookie.
User
The interface for a user.