Skip to content

Instantly share code, notes, and snippets.

@scan
Created September 6, 2012 12:53
Show Gist options
  • Save scan/3655954 to your computer and use it in GitHub Desktop.
Save scan/3655954 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
module Auth where
import Control.Monad.Trans (liftIO)
import Control.Exception (bracket)
import Happstack.Server
import Server
import Web.Authenticate.BrowserId (checkAssertion)
import Network.HTTP.Conduit (newManager, closeManager, def)
import Data.Text (Text)
checkBrowserId :: ServerPart (Maybe Text)
checkBrowserId = do
assertion <- lookText' "assertion"
liftIO $ bracket (newManager def) closeManager $ checkAssertion audience assertion
audience :: Text
audience = "http://localhost:8080/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment