yesod-auth-oauth 1.1.0.2 → 1.2.0
raw patch · 2 files changed
+18/−22 lines, 2 filesdep ~yesod-authdep ~yesod-coredep ~yesod-formPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: yesod-auth, yesod-core, yesod-form
API changes (from Hackage documentation)
Files
- Yesod/Auth/OAuth.hs +14/−18
- yesod-auth-oauth.cabal +4/−4
Yesod/Auth/OAuth.hs view
@@ -4,8 +4,8 @@ , oauthUrl , authTwitter , twitterUrl- , authTumblr- , tumblrUrl+ , authTumblr+ , tumblrUrl , module Web.Authenticate.OAuth ) where import Control.Applicative ((<$>), (<*>))@@ -22,8 +22,7 @@ import Web.Authenticate.OAuth import Yesod.Auth import Yesod.Form-import Yesod.Handler-import Yesod.Widget+import Yesod.Core data YesodOAuthException = CredentialError String Credential | SessionError String@@ -40,26 +39,25 @@ -> AuthPlugin m authOAuth oauth mkCreds = AuthPlugin name dispatch login where- getOAuthSession = maybe (throwIO $ SessionError "") return =<< lookupSession oauthSessionName name = T.pack $ oauthServerName oauth url = PluginR name [] lookupTokenSecret = bsToText . fromMaybe "" . lookup "oauth_token_secret" . unCredential oauthSessionName = "__oauth_token_secret" dispatch "GET" ["forward"] = do- render <- getUrlRender- tm <- getRouteToMaster+ render <- lift getUrlRender+ tm <- getRouteToParent let oauth' = oauth { oauthCallback = Just $ encodeUtf8 $ render $ tm url }- master <- getYesod+ master <- lift getYesod tok <- lift $ getTemporaryCredential oauth' (authHttpManager master) setSession oauthSessionName $ lookupTokenSecret tok redirect $ authorizeUrl oauth' tok- dispatch "GET" [] = do+ dispatch "GET" [] = lift $ do+ Just tokSec <- lookupSession oauthSessionName+ deleteSession oauthSessionName reqTok <- if oauthVersion oauth == OAuth10 then do oaTok <- runInputGet $ ireq textField "oauth_token"- tokSec <- getOAuthSession- deleteSession oauthSessionName return $ Credential [ ("oauth_token", encodeUtf8 oaTok) , ("oauth_token_secret", encodeUtf8 tokSec) ]@@ -67,19 +65,17 @@ (verifier, oaTok) <- runInputGet $ (,) <$> ireq textField "oauth_verifier" <*> ireq textField "oauth_token"- tokSec <- getOAuthSession- deleteSession oauthSessionName return $ Credential [ ("oauth_verifier", encodeUtf8 verifier) , ("oauth_token", encodeUtf8 oaTok) , ("oauth_token_secret", encodeUtf8 tokSec) ] master <- getYesod- accTok <- lift $ getAccessToken oauth reqTok (authHttpManager master)+ accTok <- getAccessToken oauth reqTok (authHttpManager master) creds <- liftIO $ mkCreds accTok setCreds True creds dispatch _ _ = notFound login tm = do- render <- lift getUrlRender+ render <- getUrlRender let oaUrl = render $ tm $ oauthUrl name [whamlet| <a href=#{oaUrl}>Login via #{name} |] @@ -96,9 +92,9 @@ -> AuthPlugin m authTwitter key secret = authOAuth (newOAuth { oauthServerName = "twitter"- , oauthRequestUri = "http://twitter.com/oauth/request_token"- , oauthAccessTokenUri = "http://api.twitter.com/oauth/access_token"- , oauthAuthorizeUri = "http://api.twitter.com/oauth/authorize"+ , oauthRequestUri = "https://api.twitter.com/oauth/request_token"+ , oauthAccessTokenUri = "https://api.twitter.com/oauth/access_token"+ , oauthAuthorizeUri = "https://api.twitter.com/oauth/authorize" , oauthSignatureMethod = HMACSHA1 , oauthConsumerKey = key , oauthConsumerSecret = secret
yesod-auth-oauth.cabal view
@@ -1,5 +1,5 @@ name: yesod-auth-oauth-version: 1.1.0.2+version: 1.2.0 license: BSD3 license-file: LICENSE author: Hiromi Ishii@@ -22,10 +22,10 @@ build-depends: base >= 4 && < 4.3 build-depends: authenticate-oauth >= 1.4 && < 1.5 , bytestring >= 0.9.1.4- , yesod-core >= 1.1 && < 1.2- , yesod-auth >= 1.1 && < 1.2+ , yesod-core >= 1.2 && < 1.3+ , yesod-auth >= 1.2 && < 1.3 , text >= 0.7 && < 0.12- , yesod-form >= 1.1 && < 1.3+ , yesod-form >= 1.3 && < 1.4 , transformers >= 0.2.2 && < 0.4 , lifted-base >= 0.2 && < 0.3 exposed-modules: Yesod.Auth.OAuth