The simple-session package

[ Tags: lgpl, library, web ] [ Propose Tags ]

Adds cookie-based session management to simple Controllers. To add to an application, declare the Controller setting's type an instance of HasSession, and wrap routes with withSession. For example:

data AppSettings = ...

instance HasSession AppSettings where
  ...
controllerApp settings $ withSessions $ do
  routeName \"posts\" $ ...

Then, in your controllers you can seemlessly get and set keys from the session:

get "/profile" $ do
  muserId <- sessionLookup "current_user_id"
  case muserIf of
    Nothing -> respond $ redirectTo "/login"
    Just userId -> [handle request]

Properties

Versions 0.6.0, 0.7.0, 0.8.0, 0.8.0.1, 0.8.1.0, 0.9.0.0, 0.10.0.0, 0.10.1.0, 0.10.1.1
Change log CHANGELOG.md
Dependencies base (<6), base64-bytestring, blaze-builder, byteable, bytestring, containers, cookie, cryptohash, http-types, simple (>=0.10), transformers, wai (>=3.0), wai-extra (>=3.0) [details]
License LGPL-3
Author Amit Aryeh Levy
Maintainer amit@amitlevy.com
Category Web
Home page http://simple.cx
Bug tracker http://github.com/alevy/simple/issues
Source repository head: git clone http://github.com/alevy/simple.git
Uploaded Wed Nov 18 17:02:47 UTC 2015 by AmitLevy
Distributions LTSHaskell:0.10.1.1, NixOS:0.10.1.1, Stackage:0.10.1.1, Tumbleweed:0.10.1.1
Downloads 1646 total (13 in the last 30 days)
Rating 2.0 (1 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-11-18 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees