Skip to content

Commit

Permalink
Bumping the version
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranj committed May 10, 2010
1 parent 63dc8fa commit d7d5cfb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ node-oauth
===========
A simple oauth API for node.js . This API allows users to authenticate against OAUTH providers, and thus act as OAuth consumers

Tested against both Twitter (http://twitter.com) and term.ie (http://term.ie/oauth/example/)
Tested against both Twitter (http://twitter.com), term.ie (http://term.ie/oauth/example/) and Yahoo!


Also provides rudimentary OAuth2 support, tested against facebook connect.
4 changes: 0 additions & 4 deletions examples/facebook.js

This file was deleted.

26 changes: 12 additions & 14 deletions lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ exports.OAuth.prototype._createSignature= function(signatureBase, tokenSecret) {
// consumerSecret is already encoded
var key= this._consumerSecret + "&" + tokenSecret;

//TODO: whilst we support different signature methods being passed
// we currenting only do SHA1-HMAC
var hash= ""
if( this._signatureMethod == "PLAINTEXT" ) {
hash= this._encodeData(key);
Expand All @@ -126,10 +124,6 @@ exports.OAuth.prototype.NONCE_CHARS= ['a','b','c','d','e','f','g','h','i','j','k
'Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3',
'4','5','6','7','8','9'];

exports.OAuth.prototype._createClient= function( port, hostname, sshEnabled, credentials ) {
return http.createClient(port, hostname, sshEnabled, credentials);
}

exports.OAuth.prototype._getNonce= function(nonceSize) {
var result = [];
var chars= this.NONCE_CHARS;
Expand All @@ -143,6 +137,10 @@ exports.OAuth.prototype._getNonce= function(nonceSize) {
return result.join('');
}

exports.OAuth.prototype._createClient= function( port, hostname, sshEnabled, credentials ) {
return http.createClient(port, hostname, sshEnabled, credentials);
}

exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, callback ) {
var oauthParameters= {
"oauth_timestamp": this._getTimestamp(),
Expand Down Expand Up @@ -271,7 +269,7 @@ exports.OAuth.prototype.getOAuthRequestToken= function(callback) {
}

exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) {
var oauthParameters= {
var collectedParameters= {
"oauth_timestamp": this._getTimestamp(),
"oauth_nonce": this._getNonce(this._nonceSize),
"oauth_version": this._version,
Expand All @@ -280,7 +278,7 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
};

if( oauth_token ) {
oauthParameters["oauth_token"]= oauth_token;
collectedParameters["oauth_token"]= oauth_token;
}
if( method === undefined ) {
var method= "GET";
Expand All @@ -291,22 +289,22 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
if( parsedUrl.protocol == "https:" && !parsedUrl.port ) parsedUrl.port= 443;

if( parsedUrl.query ) {
var extraParameters= querystring.parse(parsedUrl.query);
for(var key in extraParameters ) {
oauthParameters[key]= extraParameters[key];
var queryParams= querystring.parse(parsedUrl.query);
for(var key in queryParams ) {
collectedParameters[key]= queryParams[key];
}
}

var sig= this._getSignature( method, url, this._normaliseRequestParams(oauthParameters), oauth_token_secret);
var orderedParameters= this._sortRequestParams( oauthParameters );
var sig= this._getSignature( method, url, this._normaliseRequestParams(collectedParameters), oauth_token_secret);
var orderedParameters= this._sortRequestParams( collectedParameters );
orderedParameters[orderedParameters.length]= ["oauth_signature", sig];

var query="";
for( var i= 0 ; i < orderedParameters.length; i++) {
query+= orderedParameters[i][0]+"="+ this._encodeData(orderedParameters[i][1]) + "&";
}
query= query.substring(0, query.length-1);

return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query;
};

Expand Down
2 changes: 1 addition & 1 deletion seed.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
name: oauth
description: An implementation of an OAuth client.
version: 0.0.6
version: 0.0.7

0 comments on commit d7d5cfb

Please sign in to comment.