update browserid check
This commit is contained in:
parent
d464f85f9d
commit
edc2d49b9b
@ -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|
|
||||
<p>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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user