An AcidState backend for Snap's Auth Snaplet
Haskell Smarty CSS
Switch branches/tags
Nothing to show
Pull request Compare This branch is 10 commits ahead of zopa:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Snap/Snaplet/Auth/Backends
examples/site
.gitignore
LICENSE
README.md
Setup.hs
snaplet-auth-acid.cabal

README.md

snaplet-auth-acid

An AcidState backend for Snap's Auth Snaplet

Zopa is the author of this package and is attributed as such.

cabal update && cabal install snaplet-auth-acid
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}

module Main where

-- imports..
import           Snap.Snaplet.Auth.Backends.Acid             (initAcidAuthManager)

data App = App { _heist :: Snaplet (Heist App)
               , _sess  :: Snaplet SessionManager
               , _auth  :: Snaplet (AuthManager App)
               }

makeLenses ''App

instance HasHeist App where
    heistLens = subSnaplet heist

-- handles, forms and routes go here...

------------------------------------------------------------------------------
-- | The application initializer.
app :: SnapletInit App App
app = makeSnaplet "app" "An snaplet example application." Nothing $ do
    h <- nestSnaplet "" heist $ heistInit "templates"
    s <- nestSnaplet "sess" sess $ initCookieSessionManager "site_key.txt" "sess" (Just 3600)
    a <- nestSnaplet "auth" auth $ initAcidAuthManager defAuthSettings sess 
    addRoutes routes
    addAuthSplices h auth
    return $ App h s a

main :: IO ()
main = do
  (_, site, _) <- runSnaplet Nothing app
  quickHttpServe site