Skip to content

Commit

Permalink
Add support for OAuth plaintext signature method
Browse files Browse the repository at this point in the history
  • Loading branch information
simov committed Jan 6, 2015
1 parent bd0aa25 commit 3bd5421
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -442,6 +442,10 @@ the following changes to the OAuth options object:
* Instead of `consumer_secret`, specify a `private_key` string in
[PEM format](http://how2ssl.com/articles/working_with_pem_files/)
For [PLAINTEXT signing](http://oauth.net/core/1.0/#anchor22), make
the following changes to the OAuth options object:
* Pass `signature_method : 'PLAINTEXT'`
To send OAuth parameters via query params or in a post body as described in The
[Consumer Request Parameters](http://oauth.net/core/1.0/#consumer_req_param)
section of the oauth1 spec:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -33,7 +33,7 @@
"tunnel-agent": "~0.4.0",
"tough-cookie": ">=0.12.0",
"http-signature": "~0.10.0",
"oauth-sign": "~0.5.0",
"oauth-sign": "~0.6.0",
"hawk": "1.1.1",
"aws-sign2": "~0.5.0",
"stringstream": "~0.0.4",
Expand Down
17 changes: 17 additions & 0 deletions tests/test-oauth.js
Expand Up @@ -302,6 +302,23 @@ tape('rfc5849 RSA example', function(t) {
})
})

tape('plaintext signature method', function(t) {
var plaintext = request.post(
{ url: 'https://dummy.com'
, oauth:
{ consumer_secret: 'consumer_secret'
, token_secret: 'token_secret'
, signature_method: 'PLAINTEXT'
}
})

process.nextTick(function() {
t.equal('consumer_secret&token_secret', getSignature(plaintext))
plaintext.abort()
t.end()
})
})

tape('invalid transport_method', function(t) {
t.throws(
function () {
Expand Down

0 comments on commit 3bd5421

Please sign in to comment.