Skip to content

Commit a2dbd52

Browse files
committed
3.1.1 - set atc cookie to SameSiteLax so that we can add links from emails and external sites
1 parent c9ff223 commit a2dbd52

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

happstack-authenticate.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Cabal-version: 2.2
22
Name: happstack-authenticate
3-
Version: 3.1.0
3+
Version: 3.1.1
44
Synopsis: Happstack Authentication Library
55
Description: A themeable authentication library with support for username+password
66
Homepage: http://www.happstack.com/
@@ -58,6 +58,7 @@ common shared-ghcjs-properties
5858
Library
5959
import: shared-properties
6060
import: shared-ghcjs-properties
61+
ghc-options: -Werror=incomplete-patterns
6162
hs-source-dirs: src
6263
if flag(Debug)
6364
cpp-options: "-DDEBUG_CLIENT"

src/Happstack/Authenticate/Client.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,15 @@ extractJWT modelTV jr =
459459
-- (Just (String tkn)) ->
460460
-- updateAuthenticateModelFromToken modelTV tkn
461461
(Just o) ->
462-
do debugPrint $ "Got a token, but it is not a string: " ++ show o
462+
do debugStrLn $ "Got a token, but it is not a string: " ++ show o
463463
case fromJSON o of
464464
(Success tkn@(Authenticate.Token u)) ->
465465
do debugPrint $ "Got token " ++ show (u :: User)
466466
updateAuthenticateModelFromToken modelTV tkn
467467
(Error e) ->
468468
do debugStrLn $ "fromJSON aa - " ++ e
469-
_ -> debugPrint "Could not find a token that is a string"
469+
_ -> debugStrLn "Could not find a token that is a string"
470+
_ -> debugStrLn "_jrData is not an Object"
470471

471472
updateAuthenticateModelFromToken :: TVar AuthenticateModel -> Authenticate.Token -> IO ()
472473
updateAuthenticateModelFromToken modelTV (Authenticate.Token u) =

src/Happstack/Authenticate/Handlers.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import Data.Time (UTCTime, addUTCTime, diffUTCTime, getCur
3636
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds, posixSecondsToUTCTime)
3737
import Data.UserId (UserId(..), rUserId, succUserId, unUserId)
3838
import Happstack.Authenticate.Core
39-
import Happstack.Server (Cookie(httpOnly, sameSite, secure), CookieLife(Session, MaxAge), Happstack, Method(GET, HEAD), SameSite(SameSiteStrict), ServerPartT, Request(rqSecure), Response, addCookie, askRq, expireCookie, getHeaderM, lookCookie, lookCookieValue, method, mkCookie, notFound, resp, toResponseBS)
39+
import Happstack.Server (Cookie(httpOnly, sameSite, secure), CookieLife(Session, MaxAge), Happstack, Method(GET, HEAD), SameSite(SameSiteLax), ServerPartT, Request(rqSecure), Response, addCookie, askRq, expireCookie, getHeaderM, lookCookie, lookCookieValue, method, mkCookie, notFound, resp, toResponseBS)
4040
import GHC.Generics (Generic)
4141
import Prelude hiding ((.), id, exp)
4242
import System.IO (IOMode(ReadMode), withFile)
@@ -452,7 +452,7 @@ addTokenCookie :: (Happstack m) =>
452452
addTokenCookie authenticateState authenticateConfig user =
453453
do token <- issueToken authenticateState authenticateConfig user
454454
s <- rqSecure <$> askRq -- FIXME: this isn't that accurate in the face of proxies
455-
addCookie (MaxAge (60*60*24*30)) ((mkCookie authCookieName (Text.unpack token)) { sameSite = SameSiteStrict, secure = s, httpOnly = True })
455+
addCookie (MaxAge (60*60*24*30)) ((mkCookie authCookieName (Text.unpack token)) { sameSite = SameSiteLax, secure = s, httpOnly = True })
456456
return ()
457457

458458
-- | delete the `Token` `Cookie`

0 commit comments

Comments
 (0)