on master help sign in
Drop OAuth1 and AWS request signing
bd509a6mrkkrp
.travis.yml+1−1
@@ -33,7 +33,7 @@ script:
33 - cabal build
33 - cabal build
34 - cabal test --show-details=always
34 - cabal test --show-details=always
35 - cabal sdist
35 - cabal sdist
36− - cabal haddock | grep "100%" | wc -l | grep "3"
36+ - cabal haddock | grep "100%" | wc -l | grep "1"
37
37
38after_script:
38after_script:
39 - cabal install hpc-coveralls
39 - cabal install hpc-coveralls
Network/HTTP/Req.hs−28
@@ -168,10 +168,8 @@ module Network.HTTP.Req
168 -- *** Authentication
168 -- *** Authentication
169 -- $authentication
169 -- $authentication
170 , basicAuth
170 , basicAuth
171− , oAuth1
172 , oAuth2Bearer
171 , oAuth2Bearer
173 , oAuth2Token
172 , oAuth2Token
174− , awsAuth
175 -- *** Other
173 -- *** Other
176 , port
174 , port
177 , decompress
175 , decompress
@@ -237,8 +235,6 @@ import qualified Network.Connection as NC
237import qualified Network.HTTP.Client as L
235import qualified Network.HTTP.Client as L
238import qualified Network.HTTP.Client.Internal as LI
236import qualified Network.HTTP.Client.Internal as LI
239import qualified Network.HTTP.Client.TLS as L
237import qualified Network.HTTP.Client.TLS as L
240−import qualified Network.HTTP.Req.AWS as AWS
241−import qualified Network.HTTP.Req.OAuth1 as OAuth1
242import qualified Network.HTTP.Types as Y
238import qualified Network.HTTP.Types as Y
243
239
244#if MIN_VERSION_base(4,9,0)
240#if MIN_VERSION_base(4,9,0)
@@ -1059,19 +1055,6 @@ basicAuth
1059basicAuth username password = asFinalizer
1055basicAuth username password = asFinalizer
1060 (L.applyBasicAuth username password)
1056 (L.applyBasicAuth username password)
1061
1057
1062−-- | OAuth 1 authentication 'Option'.
1063−--
1064−-- See also: <https://en.wikipedia.org/wiki/OAuth>.
1065−
1066−oAuth1
1067− :: ByteString -- ^ Consumer token
1068− -> ByteString -- ^ Consumer secret
1069− -> ByteString -- ^ OAuth token
1070− -> ByteString -- ^ OAuth token secret
1071− -> Option scheme
1072−oAuth1 ctoken csecret otoken osecret = asFinalizer
1073− (OAuth1.signRequest ctoken csecret otoken osecret)
1074−
1075-- | The 'Option' adds an OAuth2 bearer token. This is treated by many
1058-- | The 'Option' adds an OAuth2 bearer token. This is treated by many
1076-- services as the equivalent of a username and password.
1059-- services as the equivalent of a username and password.
1077--
1060--
@@ -1103,17 +1086,6 @@ oAuth2Token
1103oAuth2Token token = asFinalizer
1086oAuth2Token token = asFinalizer
1104 (attachHeader "Authorization" ("token " <> token))
1087 (attachHeader "Authorization" ("token " <> token))
1105
1088
1106−-- | The 'Option' adds AWS v4 request signature.
1107−--
1108−-- See also: <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html>.
1109−
1110−awsAuth
1111− :: ByteString -- ^ AWS access key
1112− -> ByteString -- ^ AWS secret access key
1113− -> Option 'Https -- ^ Auth 'Option'
1114−awsAuth accessKey secretKey = asFinalizer
1115− (AWS.signRequest accessKey secretKey)
1116−
1117----------------------------------------------------------------------------
1089----------------------------------------------------------------------------
1118-- Request — Optional parameters — Other
1090-- Request — Optional parameters — Other
1119
1091
Network/HTTP/Req/AWS.hsdeleted−28
@@ -1,28 +0,0 @@
1−-- |
2−-- Module : Network.HTTP.Req.AWS
3−-- Copyright : © 2016 Mark Karpov
4−-- License : BSD 3 clause
5−--
6−-- Maintainer : Mark Karpov <markkarpov@openmailbox.org>
7−-- Stability : experimental
8−-- Portability : portable
9−--
10−-- Implementation of AWS v4 request signature.
11−
12−module Network.HTTP.Req.AWS
13− ( signRequest )
14−where
15−
16−import Data.ByteString (ByteString)
17−import Network.HTTP.Client
18−
19−-- | Sign a given request following AWS v4 request signing specification:
20−--
21−-- See also: <https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html>
22−
23−signRequest
24− :: ByteString -- ^ AWS access key
25− -> ByteString -- ^ AWS secret access key
26− -> Request -- ^ 'Request' to sign
27− -> Request -- ^ Resulting request
28−signRequest = undefined -- TODO
Network/HTTP/Req/OAuth1.hsdeleted−28
@@ -1,28 +0,0 @@
1−-- |
2−-- Module : Network.HTTP.Req.OAuth1
3−-- Copyright : © 2016 Mark Karpov
4−-- License : BSD 3 clause
5−--
6−-- Maintainer : Mark Karpov <markkarpov@openmailbox.org>
7−-- Stability : experimental
8−-- Portability : portable
9−--
10−-- Implementation of OAuth 1.0 signing.
11−
12−module Network.HTTP.Req.OAuth1
13− ( signRequest )
14−where
15−
16−import Data.ByteString (ByteString)
17−import Network.HTTP.Client
18−
19−-- | Sign a given request using OAuth 1.0 signing algorithm.
20−
21−signRequest
22− :: ByteString -- ^ Consumer token
23− -> ByteString -- ^ Consumer secret
24− -> ByteString -- ^ OAuth token
25− -> ByteString -- ^ OAuth token secret
26− -> Request -- ^ 'Request' to sign
27− -> Request -- ^ Resulting request
28−signRequest = undefined -- TODO
pure-tests/Network/HTTP/ReqSpec.hs−4
@@ -249,8 +249,6 @@ spec = do
249 (basicAuth username0 password0 <> basicAuth username1 password1)
249 (basicAuth username0 password0 <> basicAuth username1 password1)
250 lookup "Authorization" (L.requestHeaders request) `shouldBe`
250 lookup "Authorization" (L.requestHeaders request) `shouldBe`
251 pure (basicAuthHeader username0 password0)
251 pure (basicAuthHeader username0 password0)
252− describe "oAuth1" $
253− it "does something right" pending -- TODO
254 describe "oAuth2Bearer" $ do
252 describe "oAuth2Bearer" $ do
255 it "sets Authorization header to correct value" $
253 it "sets Authorization header to correct value" $
256 property $ \token -> do
254 property $ \token -> do
@@ -297,8 +295,6 @@ spec = do
297 (oAuth2Token token0 <> oAuth2Token token1)
295 (oAuth2Token token0 <> oAuth2Token token1)
298 lookup "Authorization" (L.requestHeaders request) `shouldBe`
296 lookup "Authorization" (L.requestHeaders request) `shouldBe`
299 pure ("token " <> token0)
297 pure ("token " <> token0)
300− describe "awsAuth" $
301− it "does something right" pending -- TODO
302 describe "port" $
298 describe "port" $
303 it "sets port overwriting the defaults" $
299 it "sets port overwriting the defaults" $
304 property $ \n -> do
300 property $ \n -> do
req.cabal+15−15
@@ -58,25 +58,25 @@ flag dev
58 default: False
58 default: False
59
59
60library
60library
61− build-depends: aeson >= 0.11 && < 1.1
61+ build-depends: aeson >= 0.11 && < 1.1
62− , base >= 4.7 && < 5.0
62+ , base >= 4.7 && < 5.0
63− , blaze-builder >= 0.3 && < 0.5
63+ , blaze-builder >= 0.3 && < 0.5
64− , bytestring >= 0.10.8 && < 0.11
64+ , bytestring >= 0.10.8 && < 0.11
65− , case-insensitive >= 0.2 && < 1.3
65+ , case-insensitive >= 0.2 && < 1.3
66− , connection >= 0.2.2 && < 0.3
66+ , connection >= 0.2.2 && < 0.3
67+ , cryptonite
67 , data-default-class
68 , data-default-class
68− , http-api-data >= 0.2 && < 0.4
69+ , http-api-data >= 0.2 && < 0.4
69− , http-client >= 0.5 && < 0.6
70+ , http-client >= 0.5 && < 0.6
70− , http-client-tls >= 0.3.2 && < 0.4
71+ , http-client-tls >= 0.3.2 && < 0.4
71− , http-types >= 0.8 && < 10.0
72+ , http-types >= 0.8 && < 10.0
72− , mtl >= 2.0 && < 3.0
73+ , mtl >= 2.0 && < 3.0
73− , text >= 0.2 && < 1.3
74+ , text >= 0.2 && < 1.3
75+ , time >= 1.2 && < 1.7
74− , transformers >= 0.4 && < 0.6
76+ , transformers >= 0.4 && < 0.6
75 if !impl(ghc >= 8.0)
77 if !impl(ghc >= 8.0)
76 build-depends: semigroups == 0.18.*
78 build-depends: semigroups == 0.18.*
77 exposed-modules: Network.HTTP.Req
79 exposed-modules: Network.HTTP.Req
78− other-modules: Network.HTTP.Req.AWS
79− , Network.HTTP.Req.OAuth1
80 if flag(dev)
80 if flag(dev)
81 ghc-options: -Wall -Werror
81 ghc-options: -Wall -Werror
82 else
82 else