clientsession 0.7

This commit is contained in:
Michael Snoyman 2011-08-19 10:36:57 +03:00
parent 716f062d5d
commit 67c1c55e41
3 changed files with 8 additions and 6 deletions

View File

@ -356,15 +356,16 @@ defaultYesodRunner s master toMasterRoute mkey murl handler req = do
$ filter (\(x, _) -> x /= nonceKey) session'
yar <- handlerToYAR master s toMasterRoute (yesodRender master) errorHandler rr murl sessionMap h
let mnonce = reqNonce rr
return $ yarToResponse (hr mnonce getExpires host exp') yar
iv <- liftIO CS.randomIV
return $ yarToResponse (hr iv mnonce getExpires host exp') yar
where
hr mnonce getExpires host exp' hs ct sm =
hr iv mnonce getExpires host exp' hs ct sm =
hs'''
where
sessionVal =
case (mkey, mnonce) of
(Just key, Just nonce)
-> encodeSession key exp' host
-> encodeSession key iv exp' host
$ Map.toList
$ Map.insert nonceKey nonce sm
_ -> mempty

View File

@ -12,12 +12,13 @@ import Data.Text (Text, pack, unpack)
import Control.Arrow ((***))
encodeSession :: CS.Key
-> CS.IV
-> UTCTime -- ^ expire time
-> ByteString -- ^ remote host
-> [(Text, Text)] -- ^ session
-> ByteString -- ^ cookie value
encodeSession key expire rhost session' =
CS.encrypt key $ encode $ SessionCookie expire rhost session'
encodeSession key iv expire rhost session' =
CS.encrypt key iv $ encode $ SessionCookie expire rhost session'
decodeSession :: CS.Key
-> UTCTime -- ^ current time

View File

@ -40,7 +40,7 @@ library
, shakespeare-css >= 0.10 && < 0.11
, blaze-builder >= 0.2.1 && < 0.4
, transformers >= 0.2 && < 0.3
, clientsession >= 0.6 && < 0.7
, clientsession >= 0.7 && < 0.8
, random >= 1.0.0.2 && < 1.1
, cereal >= 0.2 && < 0.4
, old-locale >= 1.0.0.2 && < 1.1