Skip to content

Commit

Permalink
Now working against express 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Amor Kvalheim committed Apr 15, 2010
1 parent fadb019 commit defa2ea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
4 changes: 2 additions & 2 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require.paths.unshift('lib');
require.paths.unshift('../lib');
require.paths.unshift('/Users/christian.kvalheim/coding/checkouts/express/lib');
// require.paths.unshift('/Users/christian.kvalheim/coding/checkouts/express/lib');

// Require the kiwi package manager
var kiwi = require('kiwi'),
// express = kiwi.require('express'),
express = kiwi.require('express'),
sys = require('sys'),
querystring = require('querystring');

Expand Down
11 changes: 6 additions & 5 deletions example/tests/integration/integration_test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
require.paths.unshift('../../../lib');
require.paths.unshift('/Users/christian.kvalheim/coding/checkouts/express/lib');

// Require the express libary
require('express');
require('express/plugins');
// require.paths.unshift('/Users/christian.kvalheim/coding/checkouts/express/lib');

var kiwi = require('kiwi'),
express = kiwi.require('express'),
http = require('http'),
urlParser = require('url'),
sys = require('sys'),
Expand All @@ -14,6 +11,10 @@ var kiwi = require('kiwi'),
crypto = require('oauth/crypto/sha1'),
test = require("mjsunit");

// Require the express libary
require('express');
require('express/plugins');

// Contains all the results
var testResults = [];

Expand Down
6 changes: 0 additions & 6 deletions lib/oauth/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ exports.OAuth = Plugin.extend({

plugin.oauth_service.requestToken(this.method, 'http', this.headers['host'], finalPath, this.headers, this.params, function(err, result) {
if(err) {
sys.puts("======================== status:" + err.statusCode);
sys.puts("======================== message:" + err.message);

self.halt(err.statusCode, err.message)
} else {
self.halt(200, ["oauth_token=" + result["token"], "oauth_token_secret=" + result["token_secret"], "oauth_callback_confirmed=" + result["oauth_callback_confirmed"]].join("&"));
Expand Down Expand Up @@ -124,9 +121,6 @@ exports.OAuth = Plugin.extend({

plugin.oauth_service.accessToken(this.method, 'http', this.headers['host'], finalPath, this.headers, this.params, function(err, result) {
if(err) {
sys.puts("======================== status:" + err.statusCode);
sys.puts("======================== message:" + err.message);

self.halt(err.statusCode, err.message);
} else {
self.halt(200, "oauth_token=" + result.access_token + "&oauth_token_secret=" + result.token_secret);
Expand Down
13 changes: 0 additions & 13 deletions lib/oauth/oauth_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ OAuthServices.prototype.accessToken = function(method, protocol, url, path, head
var requestParameters = this.parseParameters(headers, parameters);
if(requestParameters == null) { callback(new errors.OAuthBadRequestError("Missing required parameter"), null); return };

sys.puts(sys.inspect(requestParameters));
sys.puts(sys.inspect(headers));

// Ensure correct parameters are available
if(!this.validateParameters(requestParameters, ['oauth_consumer_key', 'oauth_token', 'oauth_signature_method', 'oauth_signature', 'oauth_timestamp', 'oauth_nonce', 'oauth_verifier'])) { callback(new errors.OAuthBadRequestError("Missing required parameter")); return };
var self = this;
Expand Down Expand Up @@ -192,11 +189,6 @@ OAuthServices.prototype.calculateSignature = function(method, protocol, url, pat
var concatString = method + "&" + querystring.escape(protocol + "://" + url + path) + "&" + querystring.escape(values.map(function(value) {
return value + "=" + parameters[value];
}, '').join("&"));
//
// sys.puts("---------------------------------------------------------------------------");
// sys.puts(concatString);
// sys.puts("---------------------------------------------------------------------------");
//
// Calculated signature
return querystring.escape(crypto.SHA1.b64_hmac_sha1(key, concatString) + "=");
}
Expand All @@ -211,11 +203,6 @@ OAuthServices.prototype.calculateSignatureGoogleWay = function(method, protocol,
var concatString = method + "&" + querystring.escape(protocol + "://" + url + path) + "&" + querystring.escape(values.map(function(value) {
return querystring.escape(value) + "=" + querystring.escape(parameters[value]);
}, '').join("&"));

// sys.puts("---------------------------------------------------------------------------");
// sys.puts(concatString);
// sys.puts("---------------------------------------------------------------------------");

// Calculated signature
return crypto.SHA1.b64_hmac_sha1(key, concatString) + "=";
}
Expand Down

0 comments on commit defa2ea

Please sign in to comment.