This module implements the management of sessions. In particular, it defines a cookie that must be sent to the client in order to enable the handling of sessions. Based on sessions, this module also defines a session store that can be used by various parts of the application in order to hold some session-specific data.
Author: Michael Hanus
Version: September 2020
sessionDataDir
:: String
The name of the local directory where the session data, e.g., cookie information, is stored. |
inSessionDataDir
:: String -> String
Prefix a file name with the directory where session data, e.g., cookie information, is stored. |
doesSessionExist
:: IO Bool
Checks whether the current user session is initialized, i.e., whether a session cookie has been already set. |
sessionCookie
:: IO PageParam
Creates a cookie to hold the current session id. |
withSessionCookie
:: HtmlPage -> IO HtmlPage
Decorates an HTML page with session cookie. |
withSessionCookieInfo
:: HtmlPage -> IO HtmlPage
Decorates an HTML page with session cookie and shows an information page when the session cookie is not set. |
emptySessionStore
:: SessionStore a
An initial value for the empty session store. |
getSessionMaybeData
:: Global (SessionStore a) -> FormReader (Maybe a)
Retrieves data for the current user session stored in a session store. |
getSessionData
:: Global (SessionStore a) -> a -> FormReader a
Retrieves data for the current user session stored in a session store where the second argument is returned if there is no data for the current session. |
writeSessionData
:: Global (SessionStore a) -> a -> IO ()
Stores data related to the current user session in a session store. |
modifySessionData
:: Global (SessionStore a) -> a -> (a -> a) -> IO ()
Modifies the data of the current user session. |
removeSessionData
:: Global (SessionStore a) -> IO ()
Removes data related to the current user session from a session store. |
The type of a session store that holds particular data used in a session. A session store consists of a list of data items for each session in the system together with the clock time of the last access. The clock time is used to remove old data in the store.
Constructors:
The name of the local directory where the session data, e.g., cookie information, is stored. For security reasons, the directory should be non-public readable.
|
Prefix a file name with the directory where session data, e.g., cookie information, is stored. |
Checks whether the current user session is initialized, i.e., whether a session cookie has been already set. |
Creates a cookie to hold the current session id. This cookie should be sent to the client together with every HTML page. |
Decorates an HTML page with session cookie. |
Decorates an HTML page with session cookie and shows an information page when the session cookie is not set. |
An initial value for the empty session store.
|
Retrieves data for the current user session stored in a session store.
Returns |
Retrieves data for the current user session stored in a session store where the second argument is returned if there is no data for the current session. |
Stores data related to the current user session in a session store. |
Modifies the data of the current user session. |
Removes data related to the current user session from a session store. |