Bumping the version

This commit is contained in:
ciaranj 2010-05-10 19:44:17 +01:00
parent 63dc8facb6
commit d7d5cfbcfe
4 changed files with 14 additions and 20 deletions

View File

@ -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 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. Also provides rudimentary OAuth2 support, tested against facebook connect.

View File

@ -1,4 +0,0 @@
var sys= require('sys')
var OAuth2= require('../lib/oauth2').OAuth2;
var oa= new OAuth2("113560732012113", "f53a25cf96e19743fdcd189307bf47ac", "https://graph.facebook.com")

View File

@ -108,8 +108,6 @@ exports.OAuth.prototype._createSignature= function(signatureBase, tokenSecret) {
// consumerSecret is already encoded // consumerSecret is already encoded
var key= this._consumerSecret + "&" + tokenSecret; var key= this._consumerSecret + "&" + tokenSecret;
//TODO: whilst we support different signature methods being passed
// we currenting only do SHA1-HMAC
var hash= "" var hash= ""
if( this._signatureMethod == "PLAINTEXT" ) { if( this._signatureMethod == "PLAINTEXT" ) {
hash= this._encodeData(key); hash= this._encodeData(key);
@ -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', 'Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3',
'4','5','6','7','8','9']; '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) { exports.OAuth.prototype._getNonce= function(nonceSize) {
var result = []; var result = [];
var chars= this.NONCE_CHARS; var chars= this.NONCE_CHARS;
@ -143,6 +137,10 @@ exports.OAuth.prototype._getNonce= function(nonceSize) {
return result.join(''); 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 ) { exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, callback ) {
var oauthParameters= { var oauthParameters= {
"oauth_timestamp": this._getTimestamp(), "oauth_timestamp": this._getTimestamp(),
@ -271,7 +269,7 @@ exports.OAuth.prototype.getOAuthRequestToken= function(callback) {
} }
exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) { exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) {
var oauthParameters= { var collectedParameters= {
"oauth_timestamp": this._getTimestamp(), "oauth_timestamp": this._getTimestamp(),
"oauth_nonce": this._getNonce(this._nonceSize), "oauth_nonce": this._getNonce(this._nonceSize),
"oauth_version": this._version, "oauth_version": this._version,
@ -280,7 +278,7 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
}; };
if( oauth_token ) { if( oauth_token ) {
oauthParameters["oauth_token"]= oauth_token; collectedParameters["oauth_token"]= oauth_token;
} }
if( method === undefined ) { if( method === undefined ) {
var method= "GET"; var method= "GET";
@ -291,14 +289,14 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
if( parsedUrl.protocol == "https:" && !parsedUrl.port ) parsedUrl.port= 443; if( parsedUrl.protocol == "https:" && !parsedUrl.port ) parsedUrl.port= 443;
if( parsedUrl.query ) { if( parsedUrl.query ) {
var extraParameters= querystring.parse(parsedUrl.query); var queryParams= querystring.parse(parsedUrl.query);
for(var key in extraParameters ) { for(var key in queryParams ) {
oauthParameters[key]= extraParameters[key]; collectedParameters[key]= queryParams[key];
} }
} }
var sig= this._getSignature( method, url, this._normaliseRequestParams(oauthParameters), oauth_token_secret); var sig= this._getSignature( method, url, this._normaliseRequestParams(collectedParameters), oauth_token_secret);
var orderedParameters= this._sortRequestParams( oauthParameters ); var orderedParameters= this._sortRequestParams( collectedParameters );
orderedParameters[orderedParameters.length]= ["oauth_signature", sig]; orderedParameters[orderedParameters.length]= ["oauth_signature", sig];
var query=""; var query="";
@ -306,7 +304,7 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
query+= orderedParameters[i][0]+"="+ this._encodeData(orderedParameters[i][1]) + "&"; query+= orderedParameters[i][0]+"="+ this._encodeData(orderedParameters[i][1]) + "&";
} }
query= query.substring(0, query.length-1); query= query.substring(0, query.length-1);
return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query; return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query;
}; };

View File

@ -1,4 +1,4 @@
--- ---
name: oauth name: oauth
description: An implementation of an OAuth client. description: An implementation of an OAuth client.
version: 0.0.6 version: 0.0.7