authenticate-oauth 1.6.0.1 → 1.7
raw patch · 3 files changed
+30/−5 lines, 3 filesdep ~basedep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, transformers
API changes (from Hackage documentation)
+ Web.Authenticate.OAuth: HMACSHA256 :: SignMethod
+ Web.Authenticate.OAuth: HMACSHA512 :: SignMethod
+ Web.Authenticate.OAuth: RSASHA256 :: PrivateKey -> SignMethod
+ Web.Authenticate.OAuth: RSASHA512 :: PrivateKey -> SignMethod
+ Web.Authenticate.OAuth.IO: HMACSHA256 :: SignMethod
+ Web.Authenticate.OAuth.IO: HMACSHA512 :: SignMethod
+ Web.Authenticate.OAuth.IO: RSASHA256 :: PrivateKey -> SignMethod
+ Web.Authenticate.OAuth.IO: RSASHA512 :: PrivateKey -> SignMethod
Files
- ChangeLog.md +4/−0
- Web/Authenticate/OAuth.hs +21/−1
- authenticate-oauth.cabal +5/−4
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.7++* Add support for following new SignMethod `HMACSHA256`, `HMACSHA512`, `RSASHA256`, `RSASHA512`+ ## 1.6 * Add checkOAuth
Web/Authenticate/OAuth.hs view
@@ -65,7 +65,7 @@ #else import Data.Data #endif-import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, hashSHA1)+import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, hashSHA1, hashSHA256, hashSHA512) ----------------------------------------------------------------------@@ -133,7 +133,11 @@ -- | Data type for signature method. data SignMethod = PLAINTEXT | HMACSHA1+ | HMACSHA256+ | HMACSHA512 | RSASHA1 PrivateKey+ | RSASHA256 PrivateKey+ | RSASHA512 PrivateKey deriving (Show, Eq, Read, Data, Typeable) @@ -290,10 +294,22 @@ text <- getBaseString tok req let key = BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok] return $ encode $ toStrict $ bytestringDigest $ hmacSha1 (fromStrict key) text+ HMACSHA256 -> do+ text <- getBaseString tok req+ let key = BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]+ return $ encode $ toStrict $ bytestringDigest $ hmacSha256 (fromStrict key) text+ HMACSHA512 -> do+ text <- getBaseString tok req+ let key = BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]+ return $ encode $ toStrict $ bytestringDigest $ hmacSha512 (fromStrict key) text PLAINTEXT -> return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok] RSASHA1 pr -> liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA1 pr) (getBaseString tok req)+ RSASHA256 pr ->+ liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA256 pr) (getBaseString tok req)+ RSASHA512 pr ->+ liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA512 pr) (getBaseString tok req) -- | Test existing OAuth signature. -- Since 1.5.2@@ -513,7 +529,11 @@ showSigMtd :: SignMethod -> BS.ByteString showSigMtd PLAINTEXT = "PLAINTEXT" showSigMtd HMACSHA1 = "HMAC-SHA1"+showSigMtd HMACSHA256 = "HMAC-SHA256"+showSigMtd HMACSHA512 = "HMAC-SHA512" showSigMtd (RSASHA1 _) = "RSA-SHA1"+showSigMtd (RSASHA256 _) = "RSA-SHA256"+showSigMtd (RSASHA512 _) = "RSA-SHA512" addNonce :: MonadIO m => Credential -> m Credential addNonce cred = do
authenticate-oauth.cabal view
@@ -1,5 +1,6 @@+cabal-version: >= 1.10 name: authenticate-oauth-version: 1.6.0.1+version: 1.7 license: BSD3 license-file: LICENSE author: Hiromi Ishii@@ -8,13 +9,13 @@ description: API docs and the README are available at <http://www.stackage.org/package/authenticate-oauth>. category: Web stability: Stable-cabal-version: >= 1.6 build-type: Simple homepage: http://github.com/yesodweb/authenticate extra-source-files: README.md ChangeLog.md library- build-depends: base >= 4 && < 5+ default-language: Haskell2010+ build-depends: base >= 4.10 && < 5 , http-client >= 0.3 , transformers >= 0.1 && < 0.6 , bytestring >= 0.9@@ -22,7 +23,7 @@ , RSA >= 2.0 && < 2.5 , time , data-default- , base64-bytestring >= 0.1 && < 1.1+ , base64-bytestring >= 0.1 && < 1.3 , SHA >= 1.4 && < 1.7 , random , http-types >= 0.6