packages feed

yesod-auth-oauth 0.8.1 → 1.0.0

raw patch · 3 files changed

+37/−29 lines, 3 filesdep +transformersdep −conduitdep −hamletdep ~authenticate-oauthdep ~yesod-authdep ~yesod-corePVP ok

version bump matches the API change (PVP)

Dependencies added: transformers

Dependencies removed: conduit, hamlet

Dependency ranges changed: authenticate-oauth, yesod-auth, yesod-core, yesod-form

API changes (from Hackage documentation)

+ Yesod.Auth.OAuth: authTumblr :: YesodAuth m => ByteString -> ByteString -> AuthPlugin m
+ Yesod.Auth.OAuth: tumblrUrl :: AuthRoute

Files

Yesod/Auth/OAuth.hs view
@@ -1,30 +1,29 @@-{-# LANGUAGE CPP, QuasiQuotes, OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes, OverloadedStrings #-} {-# OPTIONS_GHC -fwarn-unused-imports #-} module Yesod.Auth.OAuth     ( authOAuth     , oauthUrl     , authTwitter     , twitterUrl+	, authTumblr+	, tumblrUrl     , module Web.Authenticate.OAuth     ) where -#include "qq.h"- import Yesod.Auth import Yesod.Form import Yesod.Handler import Yesod.Widget-import Text.Hamlet (shamlet) import Web.Authenticate.OAuth import Data.Maybe import Control.Arrow ((***))+import Control.Monad.IO.Class import Data.Text (Text) import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8, decodeUtf8With) import Data.Text.Encoding.Error (lenientDecode) import Data.ByteString (ByteString) import Control.Applicative ((<$>), (<*>))-import Data.Conduit  oauthUrl :: Text -> AuthRoute oauthUrl name = PluginR name ["forward"]@@ -69,14 +68,14 @@                                 ]       master <- getYesod       accTok <- lift $ getAccessToken oauth reqTok (authHttpManager master)-      creds  <- resourceLiftBase $ mkCreds accTok+      creds  <- liftIO $ mkCreds accTok       setCreds True creds     dispatch _ _ = notFound     login tm = do         render <- lift getUrlRender         let oaUrl = render $ tm $ oauthUrl name-        addHtml-          [QQ(shamlet)| <a href=#{oaUrl}>Login via #{name} |]+        addWidget+          [whamlet| <a href=#{oaUrl}>Login via #{name} |]  authTwitter :: YesodAuth m             => ByteString -- ^ Consumer Key@@ -100,6 +99,29 @@  twitterUrl :: AuthRoute twitterUrl = oauthUrl "twitter"++authTumblr :: YesodAuth m+            => ByteString -- ^ Consumer Key+            -> ByteString -- ^ Consumer Secret+            -> AuthPlugin m+authTumblr key secret = authOAuth+                (newOAuth { oauthServerName      = "tumblr"+                          , oauthRequestUri      = "http://www.tumblr.com/oauth/request_token"+                          , oauthAccessTokenUri  = "http://www.tumblr.com/oauth/access_token"+                          , oauthAuthorizeUri    = "http://www.tumblr.com/oauth/authorize"+                          , oauthSignatureMethod = HMACSHA1+                          , oauthConsumerKey     = key+                          , oauthConsumerSecret  = secret+                          , oauthVersion         = OAuth10a+                          })+                extractCreds+  where+    extractCreds (Credential dic) = do+        let crId = decodeUtf8With lenientDecode $ fromJust $ lookup "name" dic+        return $ Creds "tumblr" crId $ map (bsToText *** bsToText ) dic++tumblrUrl :: AuthRoute+tumblrUrl = oauthUrl "tumblr"  bsToText :: ByteString -> Text bsToText = decodeUtf8With lenientDecode
− include/qq.h
@@ -1,10 +0,0 @@---- CPP macro which choses which quasyquotes syntax to use depending--- on GHC version.------ QQ stands for quasyquote.-#if GHC7-# define QQ(x) x-#else-# define QQ(x) $x-#endif
yesod-auth-oauth.cabal view
@@ -1,5 +1,5 @@ name:            yesod-auth-oauth-version:         0.8.1+version:         1.0.0 license:         BSD3 license-file:    LICENSE author:          Hiromi Ishii@@ -10,7 +10,6 @@ cabal-version:   >= 1.6.0 build-type:      Simple homepage:        http://www.yesodweb.com/-extra-source-files: include/qq.h description:     Authentication for Yesod.  flag ghc7@@ -20,19 +19,16 @@         build-depends:   base                >= 4.3      && < 5         cpp-options:     -DGHC7     else-        build-depends:   base                >= 4        && < 4.3-    build-depends:   authenticate-oauth      >= 1.1       && < 1.2+        build-depends:   base                >= 4         && < 4.3+    build-depends:   authenticate-oauth      >= 1.3       && < 1.4                    , bytestring              >= 0.9.1.4   && < 0.10-                   , yesod-core              >= 0.10      && < 0.11-                   , yesod-auth              >= 0.8       && < 0.9+                   , yesod-core              >= 1.0       && < 1.1+                   , yesod-auth              >= 1.0       && < 1.1                    , text                    >= 0.7       && < 0.12-                   , hamlet                  >= 0.10      && < 0.11-                   , conduit                 >= 0.2       && < 0.3-                   , yesod-form              >= 0.4       && < 0.5-+                   , yesod-form              >= 1.0       && < 1.1+                   , transformers            >= 0.2.2     && < 0.3     exposed-modules: Yesod.Auth.OAuth     ghc-options:     -Wall-    include-dirs: include  source-repository head   type:     git