{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} module Yesod.Auth.OpenId ( authOpenId , forwardUrl , claimedKey , opLocalKey , credsIdentClaimed , IdentifierType (..) ) where import Yesod.Auth import qualified Web.Authenticate.OpenId as OpenId import Yesod.Form import Yesod.Core import Text.Cassius (cassius) import Data.Text (Text, isPrefixOf) import qualified Yesod.Auth.Message as Msg import Control.Exception.Lifted (SomeException, try) import Data.Maybe (fromMaybe) forwardUrl :: AuthRoute forwardUrl = PluginR "openid" ["forward"] data IdentifierType = Claimed | OPLocal authOpenId :: YesodAuth m => IdentifierType -> [(Text, Text)] -- ^ extension fields -> AuthPlugin m authOpenId idType extensionFields = AuthPlugin "openid" dispatch login where complete = PluginR "openid" ["complete"] name = "openid_identifier" login tm = do ident <- newIdent -- FIXME this is a hack to get GHC 7.6's type checker to allow the -- code, but it shouldn't be necessary let y :: a -> [(Text, Text)] -> Text y = undefined toWidget (\x -> [cassius|##{ident} background: #fff url(http://www.myopenid.com/static/openid-icon-small.gif) no-repeat scroll 0pt 50%; padding-left: 18px; |] $ x `asTypeOf` y) [whamlet| $newline never