on master help sign in
Remove upper bounds and close #161 #168
commita7868b76f77c06f09a54f245c63d893fab9b5f6f authorMichael Snoyman <michael@snoyman.com> dateFri 21 Feb 2014, 07:22 (13 years ago) parent6726336
2 files changed+147−6
Stackage/Config.hs−6 patching/patches/authenticate-oauth-1.4.0.8.patch+147
Stackage/Config.hs−6
@@ -317,12 +317,6 @@ defaultStablePackages ghcVer = unPackageMap $ execWriter $ do
317317 -- https://github.com/fpco/stackage/issues/153
318318 addRange "Michael Snoyman" "text" "< 1.0"
319319
320− -- https://github.com/fpco/stackage/issues/161
321− addRange "Michael Snoyman" "RSA" "< 1.3"
322−
323− -- https://github.com/fpco/stackage/issues/168
324− addRange "Michael Snoyman" "crypto-api" "< 0.13"
325−
326320 -- https://github.com/fpco/stackage/issues/170
327321 addRange "Michael Snoyman" "aeson" "< 0.7"
328322
patching/patches/authenticate-oauth-1.4.0.8.patchnew file+147
@@ -0,0 +1,147 @@
1+diff -ru orig/authenticate-oauth.cabal new/authenticate-oauth.cabal
2+--- orig/authenticate-oauth.cabal 2014-02-21 07:19:28.878548521 +0200
3++++ new/authenticate-oauth.cabal 2014-02-21 07:19:28.000000000 +0200
4+@@ -19,7 +19,7 @@
5+ , transformers >= 0.1 && < 0.4
6+ , bytestring >= 0.9
7+ , crypto-pubkey-types >= 0.1 && < 0.5
8+- , RSA >= 1.2 && < 1.3
9++ , RSA >= 1.2 && < 2.1
10+ , time
11+ , data-default
12+ , base64-bytestring >= 0.1 && < 1.1
13+diff -ru orig/Web/Authenticate/OAuth.hs new/Web/Authenticate/OAuth.hs
14+--- orig/Web/Authenticate/OAuth.hs 2014-02-21 07:19:28.874548521 +0200
15++++ new/Web/Authenticate/OAuth.hs 2014-02-21 07:19:28.000000000 +0200
16+@@ -1,5 +1,5 @@
17+-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses #-}
18+-{-# LANGUAGE OverloadedStrings, StandaloneDeriving #-}
19++{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, StandaloneDeriving, FlexibleContexts #-}
20++{-# LANGUAGE CPP #-}
21+ {-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
22+ module Web.Authenticate.OAuth
23+ ( -- * Data types
24+@@ -15,48 +15,50 @@
25+ authorizeUrl, authorizeUrl', getAccessToken, getTemporaryCredential,
26+ getTokenCredential, getTemporaryCredentialWithScope,
27+ getAccessTokenProxy, getTemporaryCredentialProxy,
28+- getTokenCredentialProxy,
29++ getTokenCredentialProxy,
30+ getAccessToken', getTemporaryCredential',
31+ -- * Utility Methods
32+ paramEncode, addScope, addMaybeProxy
33+ ) where
34+-import Blaze.ByteString.Builder (toByteString, Builder)
35+-import Codec.Crypto.RSA (ha_SHA1, rsassa_pkcs1_v1_5_sign)
36+-import Control.Exception
37+-import Control.Monad
38+-import Control.Monad.IO.Class (MonadIO, liftIO)
39+-import Control.Monad.Trans.Control
40+-import Control.Monad.Trans.Resource
41+-import Crypto.Types.PubKey.RSA (PrivateKey (..), PublicKey (..))
42+-import Data.ByteString.Base64
43+-import qualified Data.ByteString.Char8 as BS
44+-import qualified Data.ByteString.Lazy.Char8 as BSL
45+-import Data.Char
46+-import Data.Conduit (Source, ($$), ($=))
47+-import Data.Conduit.Blaze (builderToByteString)
48+-import qualified Data.Conduit.List as CL
49+-import Data.Default
50+-import Data.Digest.Pure.SHA
51+-import qualified Data.IORef as I
52+-import Data.List (sortBy)
53+-import Data.Maybe
54+-import Data.Time
55+-import Network.HTTP.Conduit
56+-import Network.HTTP.Types (SimpleQuery, parseSimpleQuery)
57+-import Network.HTTP.Types (Header)
58+-import Network.HTTP.Types (renderSimpleQuery, status200)
59+-import Numeric
60+-import System.Random
61+-#if MIN_VERSION_base(4,7,0)
62+-import Data.Data hiding (Proxy (..))
63+-#else
64++import Network.HTTP.Conduit
65+ import Data.Data
66++import qualified Data.ByteString.Char8 as BS
67++import qualified Data.ByteString.Lazy.Char8 as BSL
68++import Data.Maybe
69++import Network.HTTP.Types (parseSimpleQuery, SimpleQuery)
70++import Control.Exception
71++import Control.Monad
72++import Data.List (sortBy)
73++import System.Random
74++import Data.Char
75++import Data.Digest.Pure.SHA
76++import Data.ByteString.Base64
77++import Data.Time
78++import Numeric
79++#if MIN_VERSION_RSA(2, 0, 0)
80++import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, hashSHA1)
81++#else
82++import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, ha_SHA1)
83+ #endif
84++import Crypto.Types.PubKey.RSA (PrivateKey(..), PublicKey(..))
85++import Network.HTTP.Types (Header)
86++import Blaze.ByteString.Builder (toByteString)
87++import Control.Monad.IO.Class (MonadIO)
88++import Network.HTTP.Types (renderSimpleQuery, status200)
89++import Data.Conduit (($$), ($=), Source)
90++import qualified Data.Conduit.List as CL
91++import Data.Conduit.Blaze (builderToByteString)
92++import Blaze.ByteString.Builder (Builder)
93++import Control.Monad.IO.Class (liftIO)
94++import Control.Monad.Trans.Control
95++import Control.Monad.Trans.Resource
96++import Data.Default
97++import qualified Data.IORef as I
98+
99+ -- | Data type for OAuth client (consumer).
100+---
101+--- The constructor for this data type is not exposed.
102+--- Instead, you should use the 'def' method or 'newOAuth' function to retrieve a default instance,
103++--
104++-- The constructor for this data type is not exposed.
105++-- Instead, you should use the 'def' method or 'newOAuth' function to retrieve a default instance,
106+ -- and then use the records below to make modifications.
107+ -- This approach allows us to add configuration options without breaking backwards compatibility.
108+ data OAuth = OAuth { oauthServerName :: String -- ^ Service name (default: @\"\"@)
109+@@ -71,7 +73,7 @@
110+ , oauthAuthorizeUri :: String
111+ -- ^ Uri to authorize (default: @\"\"@).
112+ -- You MUST specify if you use 'authorizeUrl' or 'authorizeZUrl'';
113+- -- otherwise you can just leave this empty.
114++ -- otherwise you can just leave this empty.
115+ , oauthSignatureMethod :: SignMethod
116+ -- ^ Signature Method (default: 'HMACSHA1')
117+ , oauthConsumerKey :: BS.ByteString
118+@@ -188,7 +190,7 @@
119+ getTemporaryCredential' hook oa manager = do
120+ let req = fromJust $ parseUrl $ oauthRequestUri oa
121+ crd = maybe id (insert "oauth_callback") (oauthCallback oa) $ emptyCredential
122+- req' <- signOAuth oa crd $ hook (req { method = "POST" })
123++ req' <- signOAuth oa crd $ hook (req { method = "POST" })
124+ rsp <- httpLbs req' manager
125+ if responseStatus rsp == status200
126+ then do
127+@@ -211,7 +213,7 @@
128+ -> String -- ^ URL to authorize
129+ authorizeUrl' f oa cr = oauthAuthorizeUri oa ++ BS.unpack (renderSimpleQuery True queries)
130+ where fixed = ("oauth_token", token cr):f oa cr
131+- queries =
132++ queries =
133+ case oauthCallback oa of
134+ Nothing -> fixed
135+ Just callback -> ("oauth_callback", callback):fixed
136+@@ -346,7 +348,11 @@
137+ PLAINTEXT ->
138+ return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]
139+ RSASHA1 pr ->
140++#if MIN_VERSION_RSA(2, 0, 0)
141++ liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA1 pr) (getBaseString tok req)
142++#else
143+ liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign ha_SHA1 pr) (getBaseString tok req)
144++#endif
145+
146+ #if MIN_VERSION_http_conduit(2, 0, 0)
147+ addAuthHeader :: BS.ByteString -> Credential -> Request -> Request