snap-0.7: Snap: A Haskell Web Framework: project starter executable and glue code library

Snap.Snaplet.Session

Synopsis

Documentation

data SessionManager

Any Haskell record that is a member of the ISessionManager typeclass can be stuffed inside a SessionManager to enable all session-related functionality.

withSession :: Lens b (Snaplet SessionManager) -> Handler b v a -> Handler b v a

Wrap around a handler, committing any changes in the session at the end

commitSession :: Handler b SessionManager ()

Commit changes to session within the current request cycle

setInSession :: Text -> Text -> Handler b SessionManager ()

Set a key-value pair in the current session

getFromSession :: Text -> Handler b SessionManager (Maybe Text)

Get a key from the current session

deleteFromSession :: Text -> Handler b SessionManager ()

Remove a key from the current session

csrfToken :: Handler b SessionManager Text

Returns a CSRF Token unique to the current session

sessionToList :: Handler b SessionManager [(Text, Text)]

Return session contents as an association list

resetSession :: Handler b SessionManager ()

Deletes the session cookie, effectively resetting the session

touchSession :: Handler b SessionManager ()

Touch the session so the timeout gets refreshed