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