oauth
Advanced tools
Comparing version 0.9.7 to 0.9.8
// Returns true if this is a host that closes *before* it ends?!?! | ||
module.exports.isAnEarlyCloseHost= function( hostName ) { | ||
return hostName.match(".*google(apis)?.com$") | ||
return hostName && hostName.match(".*google(apis)?.com$") | ||
} |
@@ -33,2 +33,3 @@ var crypto= require('crypto'), | ||
"accessTokenHttpMethod": "POST"}; | ||
this._oauthParameterSeperator = ","; | ||
}; | ||
@@ -52,2 +53,3 @@ | ||
"User-Agent" : "Node authentication"}; | ||
this._oauthParameterSeperator = ","; | ||
} | ||
@@ -123,7 +125,7 @@ | ||
if( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) { | ||
authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\","; | ||
authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\""+ this._oauthParameterSeperator; | ||
} | ||
} | ||
authHeader= authHeader.substring(0, authHeader.length-1); | ||
authHeader= authHeader.substring(0, authHeader.length-this._oauthParameterSeperator.length); | ||
return authHeader; | ||
@@ -199,3 +201,3 @@ } | ||
if( this._signatureMethod == "PLAINTEXT" ) { | ||
hash= this._encodeData(key); | ||
hash= key; | ||
} | ||
@@ -202,0 +204,0 @@ else { |
{ "name" : "oauth" | ||
, "description" : "Library for interacting with OAuth 1.0, 1.0A, 2 and Echo. Provides simplified client access and allows for construction of more complex apis and OAuth providers." | ||
, "version" : "0.9.7" | ||
, "version" : "0.9.8" | ||
, "directories" : { "lib" : "./lib" } | ||
@@ -5,0 +5,0 @@ , "main" : "index.js" |
@@ -10,5 +10,15 @@ node-oauth | ||
Installation | ||
============== | ||
$ npm install oauth | ||
Change History | ||
============== | ||
* 0.9.8 | ||
- OAuth: Support overly-strict OAuth server's that require whitespace separating the Authorization Header parameters (e.g. 500px.com) (Thanks to Christian Schwarz) | ||
- OAuth: Fix incorrect double-encoding of PLAINTEXT OAuth connections (Thanks to Joe Rozner) | ||
- OAuth: Minor safety check added when checking hostnames. (Thanks to Garrick Cheung) | ||
* 0.9.7 | ||
@@ -69,4 +79,4 @@ - OAuth2: Pass back any extra response data for calls to getOAuthAccessToken (Thanks to Tang Bo Hao) | ||
Contributors | ||
============ | ||
Contributors (In no particular order) | ||
===================================== | ||
@@ -81,1 +91,4 @@ * Ciaran Jessup - ciaranj@gmail.com | ||
* Luke Baker - http://github.com/lukebaker | ||
* Christian Schwarz - http://github.com/chrischw/ | ||
* Joe Rozer - http://www.deadbytes.net | ||
* Garrick Cheung - http://www.garrickcheung.com/ |
@@ -35,2 +35,11 @@ var vows = require('vows'), | ||
}, | ||
'When generating the signature base string with PLAINTEXT': { | ||
topic: new OAuth(null, null, null, null, null, null, "PLAINTEXT"), | ||
'we get the expected result string': function (oa) { | ||
var result= oa._getSignature("GET", "http://photos.example.net/photos", | ||
"file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=PLAINTEXT&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original", | ||
"test"); | ||
assert.equal( result, "&test"); | ||
} | ||
}, | ||
'When normalising a url': { | ||
@@ -184,3 +193,7 @@ topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"), | ||
assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0",oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); | ||
} | ||
}, | ||
'Support variable whitespace separating the arguments': function(oa) { | ||
oa._oauthParameterSeperator= ", "; | ||
assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth oauth_consumer_key="consumerkey", oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1272399856", oauth_token="token", oauth_version="1.0", oauth_signature="zeOR0Wsm6EG6XSg0Vw%2FsbpoSib8%3D"'); | ||
} | ||
}, | ||
@@ -187,0 +200,0 @@ 'When get the OAuth Echo authorization header': { |
91411
92
18
1952