From 3bd542125bb0e21eb505c55bd85b29b41e923e61 Mon Sep 17 00:00:00 2001 From: simov Date: Tue, 6 Jan 2015 11:02:44 +0200 Subject: [PATCH] Add support for OAuth plaintext signature method --- README.md | 4 ++++ package.json | 2 +- tests/test-oauth.js | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f31ec4667..9084ce27a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/package.json b/package.json index e58bebdc5..f6c878899 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/test-oauth.js b/tests/test-oauth.js index ce12dad76..b16165617 100644 --- a/tests/test-oauth.js +++ b/tests/test-oauth.js @@ -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 () {