Home

Awesome

Web example: Login with warp, ructe, and diesel

This application is intended as an example of a web service handling a login session. It uses the warp web framework, the ructe template engine and the diesel database layer.

Build Status

A Session object is created for each request (except for static resources), containing a handle to a database connection pool and an Option<User> that is set if the user is logged in.

The authentication are done with bcrypt verification of hashed passwords (the hashes are stored in the database, passwords are never stored or logged in plain text).

When authenticated, the user gets a cookie (httponly, strict samesite) containing a session key, which is used for authentication through the remainder of the session.

Things that could use improvement:

Things that remains to be done:

This project was partially inspired by https://github.com/rust-lang-nursery/wg-net/issues/44 ; go there for more example projects.

Issue reports and pull requests and welcomed.