From edc2d49b9bce85acd57e9379b0f9fa52bacca16e Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 25 Mar 2012 18:54:25 +0200 Subject: [PATCH] update browserid check --- yesod-auth/browserid.hs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/yesod-auth/browserid.hs b/yesod-auth/browserid.hs index e771b6dc..bd789a81 100644 --- a/yesod-auth/browserid.hs +++ b/yesod-auth/browserid.hs @@ -11,8 +11,10 @@ import Text.Hamlet (hamlet) import Control.Monad.IO.Class (liftIO) import Yesod.Form import Network.Wai.Handler.Warp (run) +import Network.HTTP.Conduit +import Network.TLS -data BID = BID +data BID = BID { httpManager :: Manager } mkYesod "BID" [parseRoutes| / RootR GET @@ -21,27 +23,32 @@ mkYesod "BID" [parseRoutes| |] getRootR :: Handler () -getRootR = redirect RedirectTemporary $ AuthR LoginR +getRootR = redirect $ AuthR LoginR getAfterLoginR :: Handler RepHtml getAfterLoginR = do mauth <- maybeAuthId - defaultLayout $ addHamlet [hamlet| + defaultLayout $ toWidget [hamlet|

Auth: #{show mauth} |] instance Yesod BID where - approot _ = "http://localhost:3000" + approot = ApprootStatic "http://localhost:3000" instance YesodAuth BID where type AuthId BID = Text loginDest _ = AfterLoginR logoutDest _ = AuthR LoginR getAuthId = return . Just . credsIdent - authPlugins = [authBrowserId'] + authPlugins _ = [authBrowserId] + authHttpManager = httpManager instance RenderMessage BID FormMessage where renderMessage _ _ = defaultFormMessage main :: IO () -main = toWaiApp BID >>= run 3000 +main = do + m <- newManager def + { managerCheckCerts = \_ _ -> return CertificateUsageAccept + } + toWaiApp (BID m) >>= run 3000