Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module allows you to use the auth snaplet with your user database
stored in a SQLite database. When you run your application with this
snaplet, a config file will be copied into the the
snaplets/sqlite-auth
directory. This file contains all of the
configurable options for the snaplet and allows you to change them
without recompiling your application.
To use this snaplet in your application enable the session, sqlite, and auth snaplets as follows:
data App = App { ... -- your own application state here , _sess :: Snaplet SessionManager , _db :: Snaplet Sqlite , _auth :: Snaplet (AuthManager App) }
Then in your initializer you'll have something like this:
d <- nestSnaplet "db" db sqliteInit a <- nestSnaplet "auth" auth $ initSqliteAuth sess d
If you have not already created the database table for users, it will automatically be created for you the first time you run your application.
- initSqliteAuth :: SnapletLens b SessionManager -> Snaplet Sqlite -> SnapletInit b (AuthManager b)
Documentation
:: SnapletLens b SessionManager | Lens to the session snaplet |
-> Snaplet Sqlite | The sqlite snaplet |
-> SnapletInit b (AuthManager b) |
Initializer for the sqlite backend to the auth snaplet.