snaplet-redis-0.1.6: Redis support for Snap Framework

Safe HaskellNone
LanguageHaskell2010

Snap.Snaplet.Auth.Backends.Redis

Description

This module allows you to use the auth snaplet with your user database stored in a Redis instance.

In your initializer you'll need something like:

 a <- nestSnaplet "auth" auth $
          initRedisAuthManager defAuthSettings sess defaultConnectInfo

Redis Key Space

The following keys are used to store the user information in Redis. Be sure to avoid key collisions within your applications.

  • next.userId - Int representing the next spare userId.
  • user:[username] (eg. user:bob) - Hash of the user fields for user bob.
  • userid:[userId] (eg. userid:2 - bob) - Stores username for userId based lookup.
  • useremail:[email] (eg. useremail:bob@example.com - bob) - Stores email for lookup
  • usertoken:[usertoken] (eg. usertoken:XXXXXXXX - bob) - Remember Token based user lookup.
Synopsis

Documentation

initRedisAuthManager Source #

Arguments

:: SnapletLens b SessionManager

Lens into a SessionManager auth snaplet will use

-> RedisDB

Redis ConnectInfo

-> SnapletInit b (AuthManager b) 

Initialize a Redis backed AuthManager