1diff -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
5 , transformers >= 0.1 && < 0.4
7 , crypto-pubkey-types >= 0.1 && < 0.5
12 , base64-bytestring >= 0.1 && < 1.1
13diff -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
17-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses #-}
18-{-# LANGUAGE OverloadedStrings, StandaloneDeriving #-}
19+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, StandaloneDeriving, FlexibleContexts #-}
21 {-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
22 module Web.Authenticate.OAuth
25 authorizeUrl, authorizeUrl', getAccessToken, getTemporaryCredential,
26 getTokenCredential, getTemporaryCredentialWithScope,
27 getAccessTokenProxy, getTemporaryCredentialProxy,
28- getTokenCredentialProxy,
29+ getTokenCredentialProxy,
30 getAccessToken', getTemporaryCredential',
32 paramEncode, addScope, addMaybeProxy
34-import Blaze.ByteString.Builder (toByteString, Builder)
35-import Codec.Crypto.RSA (ha_SHA1, rsassa_pkcs1_v1_5_sign)
36-import Control.Exception
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
46-import Data.Conduit (Source, ($$), ($=))
47-import Data.Conduit.Blaze (builderToByteString)
48-import qualified Data.Conduit.List as CL
50-import Data.Digest.Pure.SHA
51-import qualified Data.IORef as I
52-import Data.List (sortBy)
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)
61-#if MIN_VERSION_base(4,7,0)
62-import Data.Data hiding (Proxy (..))
64+import Network.HTTP.Conduit
66+import qualified Data.ByteString.Char8 as BS
67+import qualified Data.ByteString.Lazy.Char8 as BSL
69+import Network.HTTP.Types (parseSimpleQuery, SimpleQuery)
70+import Control.Exception
72+import Data.List (sortBy)
75+import Data.Digest.Pure.SHA
76+import Data.ByteString.Base64
79+#if MIN_VERSION_RSA(2, 0, 0)
80+import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, hashSHA1)
82+import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, ha_SHA1)
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
97+import qualified Data.IORef as I
99 -- | Data type for OAuth client (consumer).
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,
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: @\"\"@)
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
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
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
133 case oauthCallback oa of
135 Just callback -> ("oauth_callback", callback):fixed
138 return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]
140+#if MIN_VERSION_RSA(2, 0, 0)
141+ liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA1 pr) (getBaseString tok req)
143 liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign ha_SHA1 pr) (getBaseString tok req)
146 #if MIN_VERSION_http_conduit(2, 0, 0)
147 addAuthHeader :: BS.ByteString -> Credential -> Request -> Request
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list