yesod-auth-oauth2 0.0.2 → 0.0.3
raw patch · 3 files changed
+19/−3 lines, 3 filesdep +lifted-base
Dependencies added: lifted-base
Files
- Yesod/Auth/OAuth2.hs +15/−1
- Yesod/Auth/OAuth2/Learn.hs +2/−1
- yesod-auth-oauth2.cabal +2/−1
Yesod/Auth/OAuth2.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-} -- | -- -- Generic OAuth2 plugin for Yesod@@ -8,18 +10,30 @@ module Yesod.Auth.OAuth2 ( authOAuth2 , oauth2Url+ , YesodOAuth2Exception(..) , module Network.OAuth.OAuth2 ) where +import Control.Exception.Lifted import Control.Monad.IO.Class import Data.ByteString (ByteString) import Data.Text (Text) import Data.Text.Encoding (decodeUtf8With, encodeUtf8) import Data.Text.Encoding.Error (lenientDecode)+import Data.Typeable import Network.OAuth.OAuth2 import Yesod.Auth import Yesod.Core import Yesod.Form++import qualified Data.ByteString.Lazy as BSL++data YesodOAuth2Exception = InvalidProfileResponse+ Text -- ^ Provider name+ BSL.ByteString -- ^ Aeson parse error+ deriving (Show, Typeable)++instance Exception YesodOAuth2Exception oauth2Url :: Text -> AuthRoute oauth2Url name = PluginR name ["forward"]
Yesod/Auth/OAuth2/Learn.hs view
@@ -13,6 +13,7 @@ ) where import Control.Applicative ((<$>), (<*>))+import Control.Exception.Lifted import Control.Monad (mzero) import Data.Aeson import Data.Text (Text)@@ -65,7 +66,7 @@ case result of Right (LearnResponse user) -> return $ toCreds user- _ -> error "Invalid response for learn profile data"+ Left err -> throwIO $ InvalidProfileResponse "learn" err toCreds :: LearnUser -> Creds m toCreds user = Creds "learn"
yesod-auth-oauth2.cabal view
@@ -1,5 +1,5 @@ name: yesod-auth-oauth2-version: 0.0.2+version: 0.0.3 license: BSD3 license-file: LICENSE author: Tom Streller@@ -31,6 +31,7 @@ , yesod-form >= 1.3 && < 1.4 , transformers >= 0.2.2 && < 0.4 , hoauth2 >= 0.3.6 && < 0.4+ , lifted-base >= 0.2.2 && < 0.4 exposed-modules: Yesod.Auth.OAuth2 Yesod.Auth.OAuth2.Google