yesod-auth-oauth 1.4.2 → 1.6.0
raw patch · 3 files changed
+35/−17 lines, 3 filesdep +unliftiodep −lifted-basedep ~authenticate-oauthdep ~yesod-authdep ~yesod-corePVP ok
version bump matches the API change (PVP)
Dependencies added: unliftio
Dependencies removed: lifted-base
Dependency ranges changed: authenticate-oauth, yesod-auth, yesod-core, yesod-form
API changes (from Hackage documentation)
- Yesod.Auth.OAuth: authOAuth :: YesodAuth m => OAuth -> (Credential -> IO (Creds m)) -> AuthPlugin m
+ Yesod.Auth.OAuth: authOAuth :: forall master. YesodAuth master => OAuth -> (Credential -> IO (Creds master)) -> AuthPlugin master
Files
- ChangeLog.md +4/−0
- Yesod/Auth/OAuth.hs +25/−11
- yesod-auth-oauth.cabal +6/−6
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.6.0++* Upgrade to yesod-core 1.6.0+ ## 1.4.2 * Fix warnings
Yesod/Auth/OAuth.hs view
@@ -1,5 +1,8 @@ {-# LANGUAGE DeriveDataTypeable, OverloadedStrings, QuasiQuotes #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE ScopedTypeVariables #-} module Yesod.Auth.OAuth ( authOAuth , oauthUrl@@ -12,15 +15,15 @@ ) where import Control.Applicative as A ((<$>), (<*>)) import Control.Arrow ((***))-import Control.Exception.Lifted+import UnliftIO.Exception import Control.Monad.IO.Class+import UnliftIO (MonadUnliftIO) import Data.ByteString (ByteString) import Data.Maybe import Data.Text (Text) import qualified Data.Text as T import Data.Text.Encoding (decodeUtf8With, encodeUtf8) import Data.Text.Encoding.Error (lenientDecode)-import Data.Typeable import Web.Authenticate.OAuth import Yesod.Auth import Yesod.Form@@ -35,26 +38,37 @@ oauthUrl :: Text -> AuthRoute oauthUrl name = PluginR name ["forward"] -authOAuth :: YesodAuth m+authOAuth :: forall master. YesodAuth master => OAuth -- ^ 'OAuth' data-type for signing.- -> (Credential -> IO (Creds m)) -- ^ How to extract ident.- -> AuthPlugin m+ -> (Credential -> IO (Creds master)) -- ^ How to extract ident.+ -> AuthPlugin master authOAuth oauth mkCreds = AuthPlugin name dispatch login where name = T.pack $ oauthServerName oauth url = PluginR name [] lookupTokenSecret = bsToText . fromMaybe "" . lookup "oauth_token_secret" . unCredential++ oauthSessionName :: Text oauthSessionName = "__oauth_token_secret" + dispatch+ :: ( MonadHandler m+ , master ~ HandlerSite m+ , Auth ~ SubHandlerSite m+ , MonadUnliftIO m+ )+ => Text+ -> [Text]+ -> m TypedContent dispatch "GET" ["forward"] = do- render <- lift getUrlRender+ render <- getUrlRender tm <- getRouteToParent let oauth' = oauth { oauthCallback = Just $ encodeUtf8 $ render $ tm url }- master <- lift getYesod- tok <- lift $ getTemporaryCredential oauth' (authHttpManager master)+ manager <- authHttpManager+ tok <- getTemporaryCredential oauth' manager setSession oauthSessionName $ lookupTokenSecret tok redirect $ authorizeUrl oauth' tok- dispatch "GET" [] = lift $ do+ dispatch "GET" [] = do Just tokSec <- lookupSession oauthSessionName deleteSession oauthSessionName reqTok <-@@ -72,8 +86,8 @@ , ("oauth_token", encodeUtf8 oaTok) , ("oauth_token_secret", encodeUtf8 tokSec) ]- master <- getYesod- accTok <- getAccessToken oauth reqTok (authHttpManager master)+ manager <- authHttpManager+ accTok <- getAccessToken oauth reqTok manager creds <- liftIO $ mkCreds accTok setCredsRedirect creds dispatch _ _ = notFound
yesod-auth-oauth.cabal view
@@ -1,5 +1,5 @@ name: yesod-auth-oauth-version: 1.4.2+version: 1.6.0 license: BSD3 license-file: LICENSE author: Hiromi Ishii@@ -21,14 +21,14 @@ cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3- build-depends: authenticate-oauth >= 1.5 && < 1.6+ build-depends: authenticate-oauth >= 1.5 && < 1.7 , bytestring >= 0.9.1.4- , yesod-core >= 1.4 && < 1.5- , yesod-auth >= 1.4 && < 1.5+ , yesod-core >= 1.6 && < 1.7+ , yesod-auth >= 1.6 && < 1.7 , text >= 0.7- , yesod-form >= 1.4 && < 1.5+ , yesod-form >= 1.6 && < 1.7 , transformers >= 0.2.2 && < 0.6- , lifted-base >= 0.2 && < 0.3+ , unliftio exposed-modules: Yesod.Auth.OAuth ghc-options: -Wall