Safe Haskell | None |
---|---|
Language | Haskell98 |
This module allows you to use the auth snaplet with your user database stored
in a MySQL database. When you run your application with this snaplet, a
config file will be copied into the the snaplets/mysql-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, mysql, and auth snaplets as follows:
data App = App { ... -- your own application state here , _sess :: Snaplet SessionManager , _db :: Snaplet Mysql , _auth :: Snaplet (AuthManager App) }
Then in your initializer you'll have something like this:
d <- nestSnaplet "db" db mysqlInit a <- nestSnaplet "auth" auth $ initMysqlAuth 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.
- initMysqlAuth :: SnapletLens b SessionManager -> Snaplet Mysql -> SnapletInit b (AuthManager b)
Documentation
:: SnapletLens b SessionManager | Lens to the session snaplet |
-> Snaplet Mysql | The mysql snaplet |
-> SnapletInit b (AuthManager b) |
Initializer for the mysql backend to the auth snaplet.