| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Web.Spock.SessionActions
Synopsis
- type SessionId = Text
- sessionRegenerateId :: SpockActionCtx ctx conn sess st ()
- sessionDestroy :: SpockActionCtx ctx conn sess st ()
- getSessionId :: SpockActionCtx ctx conn sess st SessionId
- readSession :: SpockActionCtx ctx conn sess st sess
- writeSession :: sess -> SpockActionCtx ctx conn sess st ()
- modifySession :: (sess -> sess) -> SpockActionCtx ctx conn sess st ()
- modifySession' :: (sess -> (sess, a)) -> SpockActionCtx ctx conn sess st a
- modifyReadSession :: (sess -> sess) -> SpockActionCtx ctx conn sess st sess
Documentation
sessionRegenerateId :: SpockActionCtx ctx conn sess st () Source #
Regenerate the users sessionId. This preserves all stored data. Call this prior to logging in a user to prevent session fixation attacks. Server backends revoke the old ID; a client backend issues new ID/CSRF values but cannot revoke copies of previously issued cookies.
sessionDestroy :: SpockActionCtx ctx conn sess st () Source #
Expire this browser's cookie and discard the current request's session. Server backends also revoke the stored session. Previously issued stateless cookies remain replayable until expiry or key removal. No replacement is created until another session action is used. Use a CSRF-protected logout.
getSessionId :: SpockActionCtx ctx conn sess st SessionId Source #
Get the current users sessionId. Note that this ID should only be shown to it's owner as otherwise sessions can be hijacked.
readSession :: SpockActionCtx ctx conn sess st sess Source #
Read the stored session
writeSession :: sess -> SpockActionCtx ctx conn sess st () Source #
Write to the current session using the configured server or cookie backend.
modifySession :: (sess -> sess) -> SpockActionCtx ctx conn sess st () Source #
Modify the current session. Server backends perform this atomically in the store. Client backends modify this request's copy; simultaneous requests can overwrite one another when the browser accepts their response cookies.
modifySession' :: (sess -> (sess, a)) -> SpockActionCtx ctx conn sess st a Source #
Modify the stored session and return a value
modifyReadSession :: (sess -> sess) -> SpockActionCtx ctx conn sess st sess Source #
Modify the stored session and return the new value after modification