yesod / yesod-auth / browserid

getRootR :: Handler ()
getRootR = redirect RedirectTemporary $ AuthR LoginR
 
getAfterLoginR :: Handler RepHtml
getAfterLoginR = do
    mauth <- maybeAuthId
    defaultLayout $ addHamlet [hamlet|
<p>Auth: #{show mauth}
|]
 
instance Yesod BID where
    approot _ = "http://localhost:3000"
 
instance YesodAuth BID where
    type AuthId BID = Text
    loginDest _ = AfterLoginR
    logoutDest _ = AuthR LoginR
    getAuthId = return . Just . credsIdent
    authPlugins = [authBrowserId']
 
instance RenderMessage BID FormMessage where
    renderMessage _ _ = defaultFormMessage
 
main :: IO ()
main = toWaiApp BID >>= run 3000

 

posted @ 2012-03-19 11:33  kelby  阅读(190)  评论(0编辑  收藏  举报