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




data SessionManager Source

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 aSource

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

commitSession :: Handler b SessionManager ()Source

Commit changes to session within the current request cycle

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

Set a key-value pair in the current session

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

Get a key from the current session

deleteFromSession :: Text -> Handler b SessionManager ()Source

Remove a key from the current session

csrfToken :: Handler b SessionManager TextSource

Returns a CSRF Token unique to the current session

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

Return session contents as an association list

resetSession :: Handler b SessionManager ()Source

Deletes the session cookie, effectively resetting the session

touchSession :: Handler b SessionManager ()Source

Touch the session so the timeout gets refreshed