actix-identity
Identity management for Actix Web.
Identity management for Actix Web.
actix-identity can be used to track identity of a user across multiple requests. It is built on top of HTTP sessions, via actix-session.
Getting started
To start using identity management in your Actix Web application you must register [IdentityMiddleware] and SessionMiddleware as middleware on your App:
use ;
use IdentityMiddleware;
use ;
async
User identities can be created, accessed and destroyed using the [Identity] extractor in your request handlers:
use ;
use Identity;
use RedisSessionStore;
async
async
async
Advanced configuration
By default, actix-identity does not automatically log out users. You can change this behavior by customizing the configuration for [IdentityMiddleware] via [IdentityMiddleware::builder].
In particular, you can automatically log out users who:
- have been inactive for a while (see
IdentityMiddlewareBuilder::visit_deadline); - logged in too long ago (see
IdentityMiddlewareBuilder::login_deadline).