-
Notifications
You must be signed in to change notification settings - Fork 71
Add oauth1 support #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Network.Wreq.Internal.OAuth1 | ||
( | ||
signRequest | ||
) where | ||
|
||
import Network.HTTP.Client (Request(..)) | ||
import Network.Wreq.Internal.Types (Auth(..)) | ||
import Web.Authenticate.OAuth ( signOAuth, newOAuth, oauthConsumerKey | ||
, oauthConsumerSecret, newCredential) | ||
|
||
signRequest :: Auth -> Request -> IO Request | ||
signRequest (OAuth1 consumerToken consumerSecret token tokenSecret) requestToSign = signOAuth app creds requestToSign | ||
where | ||
app = newOAuth { oauthConsumerKey = consumerToken, oauthConsumerSecret = consumerSecret } | ||
creds = newCredential token tokenSecret | ||
|
||
signRequest _ requestToSign = return requestToSign | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the use of a wildcard pattern here. This suggests it needs a comment. Actually, wait, this is just ugly.. You're already pattern-matching on the Instead, you should unpack the constructor and pass its While you're at it, please also fix that API mistake for the AWS code in a separate commit :-) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ data Auth = BasicAuth S.ByteString S.ByteString | |
| AWSAuth AWSAuthVersion S.ByteString S.ByteString | ||
-- ^ Amazon Web Services request signing | ||
-- AWSAuthVersion key secret | ||
| OAuth1 S.ByteString S.ByteString S.ByteString S.ByteString | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please document this field. |
||
deriving (Eq, Show, Typeable) | ||
|
||
data AWSAuthVersion = AWSv4 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ library | |
other-modules: | ||
Network.Wreq.Internal | ||
Network.Wreq.Internal.AWS | ||
Network.Wreq.Internal.OAuth1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The module names in this list are sorted. Please add this in the correct lexicographical position. |
||
Network.Wreq.Internal.Lens | ||
Network.Wreq.Internal.Link | ||
Network.Wreq.Internal.Types | ||
|
@@ -90,6 +91,7 @@ library | |
PSQueue >= 1.1, | ||
aeson >= 0.7.0.3, | ||
attoparsec >= 0.11.1.0, | ||
authenticate-oauth == 1.5.*, | ||
base >= 4.5 && < 5, | ||
base16-bytestring, | ||
byteable, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[bos wrote] While you're at it, please also fix that API mistake for the AWS code in a separate commit
We're not passing the auth record to AWS.signRequest, but only the constituent parts. What could I do better here?