aboutsummaryrefslogtreecommitdiff
path: root/node_modules/passport-facebook
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/passport-facebook')
-rw-r--r--node_modules/passport-facebook/.npmignore8
-rw-r--r--node_modules/passport-facebook/LICENSE20
-rw-r--r--node_modules/passport-facebook/README.md196
-rw-r--r--node_modules/passport-facebook/lib/errors/facebookauthorizationerror.js30
-rw-r--r--node_modules/passport-facebook/lib/errors/facebookgraphapierror.js32
-rw-r--r--node_modules/passport-facebook/lib/errors/facebooktokenerror.js36
-rw-r--r--node_modules/passport-facebook/lib/index.js9
-rw-r--r--node_modules/passport-facebook/lib/profile.js38
-rw-r--r--node_modules/passport-facebook/lib/strategy.js240
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/.npmignore8
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/LICENSE20
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/README.md124
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/authorizationerror.js44
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/internaloautherror.js49
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/tokenerror.js36
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/index.js16
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/null.js13
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/session.js85
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js376
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/lib/utils.js30
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/.npmignore1
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/LICENSE8
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Makefile7
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Readme.md187
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/server.js168
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs21
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs24
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/layout.ejs9
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/github-example.js73
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js31
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/index.js3
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/_utils.js4
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth.js581
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js214
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/sha1.js334
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/package.json54
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauth2tests.js290
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauthtests.js1064
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/sha1tests.js13
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/shared.js26
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.jshintrc20
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.travis.yml15
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/LICENSE20
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/README.md61
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/index.js15
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/strategy.js28
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/package.json72
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/LICENSE21
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/index.js55
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/package.json30
-rw-r--r--node_modules/passport-facebook/node_modules/passport-oauth2/package.json80
-rw-r--r--node_modules/passport-facebook/package.json76
52 files changed, 0 insertions, 5015 deletions
diff --git a/node_modules/passport-facebook/.npmignore b/node_modules/passport-facebook/.npmignore
deleted file mode 100644
index a50451d..0000000
--- a/node_modules/passport-facebook/.npmignore
+++ /dev/null
@@ -1,8 +0,0 @@
-Makefile
-docs/
-examples/
-reports/
-test/
-
-.jshintrc
-.travis.yml
diff --git a/node_modules/passport-facebook/LICENSE b/node_modules/passport-facebook/LICENSE
deleted file mode 100644
index 0554e9e..0000000
--- a/node_modules/passport-facebook/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2011-2016 Jared Hanson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/passport-facebook/README.md b/node_modules/passport-facebook/README.md
deleted file mode 100644
index 0228446..0000000
--- a/node_modules/passport-facebook/README.md
+++ /dev/null
@@ -1,196 +0,0 @@
-# passport-facebook
-
-[![Build](https://img.shields.io/travis/jaredhanson/passport-facebook.svg)](https://travis-ci.org/jaredhanson/passport-facebook)
-[![Coverage](https://img.shields.io/coveralls/jaredhanson/passport-facebook.svg)](https://coveralls.io/r/jaredhanson/passport-facebook)
-[![Quality](https://img.shields.io/codeclimate/github/jaredhanson/passport-facebook.svg?label=quality)](https://codeclimate.com/github/jaredhanson/passport-facebook)
-[![Dependencies](https://img.shields.io/david/jaredhanson/passport-facebook.svg)](https://david-dm.org/jaredhanson/passport-facebook)
-
-
-[Passport](http://passportjs.org/) strategy for authenticating with [Facebook](http://www.facebook.com/)
-using the OAuth 2.0 API.
-
-This module lets you authenticate using Facebook in your Node.js applications.
-By plugging into Passport, Facebook authentication can be easily and
-unobtrusively integrated into any application or framework that supports
-[Connect](http://www.senchalabs.org/connect/)-style middleware, including
-[Express](http://expressjs.com/).
-
-## Install
-
- $ npm install passport-facebook
-
-## Usage
-
-#### Create an Application
-
-Before using `passport-facebook`, you must register an application with
-Facebook. If you have not already done so, a new application can be created at
-[Facebook Developers](https://developers.facebook.com/). Your application will
-be issued an app ID and app secret, which need to be provided to the strategy.
-You will also need to configure a redirect URI which matches the route in your
-application.
-
-#### Configure Strategy
-
-The Facebook authentication strategy authenticates users using a Facebook
-account and OAuth 2.0 tokens. The app ID and secret obtained when creating an
-application are supplied as options when creating the strategy. The strategy
-also requires a `verify` callback, which receives the access token and optional
-refresh token, as well as `profile` which contains the authenticated user's
-Facebook profile. The `verify` callback must call `cb` providing a user to
-complete authentication.
-
-```js
-passport.use(new FacebookStrategy({
- clientID: FACEBOOK_APP_ID,
- clientSecret: FACEBOOK_APP_SECRET,
- callbackURL: "http://localhost:3000/auth/facebook/callback"
- },
- function(accessToken, refreshToken, profile, cb) {
- User.findOrCreate({ facebookId: profile.id }, function (err, user) {
- return cb(err, user);
- });
- }
-));
-```
-
-#### Authenticate Requests
-
-Use `passport.authenticate()`, specifying the `'facebook'` strategy, to
-authenticate requests.
-
-For example, as route middleware in an [Express](http://expressjs.com/)
-application:
-
-```js
-app.get('/auth/facebook',
- passport.authenticate('facebook'));
-
-app.get('/auth/facebook/callback',
- passport.authenticate('facebook', { failureRedirect: '/login' }),
- function(req, res) {
- // Successful authentication, redirect home.
- res.redirect('/');
- });
-```
-
-## Examples
-
-Developers using the popular [Express](http://expressjs.com/) web framework can
-refer to an [example](https://github.com/passport/express-4.x-facebook-example)
-as a starting point for their own web applications.
-
-## FAQ
-
-##### How do I ask a user for additional permissions?
-
-If you need additional permissions from the user, the permissions can be
-requested via the `scope` option to `passport.authenticate()`.
-
-```js
-app.get('/auth/facebook',
- passport.authenticate('facebook', { scope: ['user_friends', 'manage_pages'] }));
-```
-
-Refer to [permissions with Facebook Login](https://developers.facebook.com/docs/facebook-login/permissions/overview)
-for further details.
-
-##### How do I re-ask for for declined permissions?
-
-Set the `authType` option to `rerequest` when authenticating.
-
-```js
-app.get('/auth/facebook',
- passport.authenticate('facebook', { authType: 'rerequest', scope: ['user_friends', 'manage_pages'] }));
-```
-
-Refer to [re-asking for declined permissions](https://developers.facebook.com/docs/facebook-login/web#re-asking-declined-permissions)
-for further details.
-
-##### How do I obtain a user profile with specific fields?
-
-The Facebook profile contains a lot of information about a user. By default,
-not all the fields in a profile are returned. The fields need by an application
-can be indicated by setting the `profileFields` option.
-
-```js
-new FacebookStrategy({
- clientID: FACEBOOK_APP_ID,
- clientSecret: FACEBOOK_APP_SECRET,
- callbackURL: "http://localhost:3000/auth/facebook/callback",
- profileFields: ['id', 'displayName', 'photos', 'email']
-}), ...)
-```
-
-Refer to the [User](https://developers.facebook.com/docs/graph-api/reference/v2.5/user)
-section of the Graph API Reference for the complete set of available fields.
-
-##### How do I include app secret proof in API requests?
-
-Set the `enableProof` option when creating the strategy.
-
-```js
-new FacebookStrategy({
- clientID: FACEBOOK_APP_ID,
- clientSecret: FACEBOOK_APP_SECRET,
- callbackURL: "http://localhost:3000/auth/facebook/callback",
- enableProof: true
-}, ...)
-```
-
-As detailed in [securing graph API requests](https://developers.facebook.com/docs/graph-api/securing-requests#appsecret_proof),
-requiring the app secret for server API requests helps prevent use of tokens
-stolen by malicous software or man in the middle attacks.
-
-##### Why is #\_=\_ appended to the redirect URI?
-
-This behavior is "by design" according to Facebook's response to a [bug](https://developers.facebook.com/bugs/318390728250352)
-filed regarding this issue.
-
-Fragment identifiers are not supplied in requests made to a server, and as such
-this strategy is not aware that this behavior is exhibited and is not affected
-by it. If desired, this fragment can be removed on the client side. Refer to
-this [discussion](http://stackoverflow.com/questions/7131909/facebook-callback-appends-to-return-url) on
-Stack Overflow for recommendations on how to accomplish such removal.
-
-
-## Contributing
-
-#### Tests
-
-The test suite is located in the `test/` directory. All new features are
-expected to have corresponding test cases. Ensure that the complete test suite
-passes by executing:
-
-```bash
-$ make test
-```
-
-#### Coverage
-
-The test suite covers 100% of the code base. All new feature development is
-expected to maintain that level. Coverage reports can be viewed by executing:
-
-```bash
-$ make test-cov
-$ make view-cov
-```
-
-## Support
-
-#### Funding
-
-This software is provided to you as open source, free of charge. The time and
-effort to develop and maintain this project is dedicated by [@jaredhanson](https://github.com/jaredhanson).
-If you (or your employer) benefit from this project, please consider a financial
-contribution. Your contribution helps continue the efforts that produce this
-and other open source software.
-
-Funds are accepted via [PayPal](https://paypal.me/jaredhanson), [Venmo](https://venmo.com/jaredhanson),
-and [other](http://jaredhanson.net/pay) methods. Any amount is appreciated.
-
-## License
-
-[The MIT License](http://opensource.org/licenses/MIT)
-
-Copyright (c) 2011-2016 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
diff --git a/node_modules/passport-facebook/lib/errors/facebookauthorizationerror.js b/node_modules/passport-facebook/lib/errors/facebookauthorizationerror.js
deleted file mode 100644
index 3c14c96..0000000
--- a/node_modules/passport-facebook/lib/errors/facebookauthorizationerror.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * `FacebookAuthorizationError` error.
- *
- * FacebookAuthorizationError represents an error in response to an
- * authorization request on Facebook. Note that these responses don't conform
- * to the OAuth 2.0 specification.
- *
- * References:
- * - https://developers.facebook.com/docs/reference/api/errors/
- *
- * @constructor
- * @param {string} [message]
- * @param {number} [code]
- * @access public
- */
-function FacebookAuthorizationError(message, code) {
- Error.call(this);
- Error.captureStackTrace(this, arguments.callee);
- this.name = 'FacebookAuthorizationError';
- this.message = message;
- this.code = code;
- this.status = 500;
-}
-
-// Inherit from `Error`.
-FacebookAuthorizationError.prototype.__proto__ = Error.prototype;
-
-
-// Expose constructor.
-module.exports = FacebookAuthorizationError;
diff --git a/node_modules/passport-facebook/lib/errors/facebookgraphapierror.js b/node_modules/passport-facebook/lib/errors/facebookgraphapierror.js
deleted file mode 100644
index a95f6ab..0000000
--- a/node_modules/passport-facebook/lib/errors/facebookgraphapierror.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * `FacebookGraphAPIError` error.
- *
- * References:
- * - https://developers.facebook.com/docs/reference/api/errors/
- *
- * @constructor
- * @param {string} [message]
- * @param {string} [type]
- * @param {number} [code]
- * @param {number} [subcode]
- * @param {string} [traceID]
- * @access public
- */
-function FacebookGraphAPIError(message, type, code, subcode, traceID) {
- Error.call(this);
- Error.captureStackTrace(this, arguments.callee);
- this.name = 'FacebookGraphAPIError';
- this.message = message;
- this.type = type;
- this.code = code;
- this.subcode = subcode;
- this.traceID = traceID;
- this.status = 500;
-}
-
-// Inherit from `Error`.
-FacebookGraphAPIError.prototype.__proto__ = Error.prototype;
-
-
-// Expose constructor.
-module.exports = FacebookGraphAPIError;
diff --git a/node_modules/passport-facebook/lib/errors/facebooktokenerror.js b/node_modules/passport-facebook/lib/errors/facebooktokenerror.js
deleted file mode 100644
index ff4e9dc..0000000
--- a/node_modules/passport-facebook/lib/errors/facebooktokenerror.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * `FacebookTokenError` error.
- *
- * FacebookTokenError represents an error received from a Facebook's token
- * endpoint. Note that these responses don't conform to the OAuth 2.0
- * specification.
- *
- * References:
- * - https://developers.facebook.com/docs/reference/api/errors/
- *
- * @constructor
- * @param {string} [message]
- * @param {string} [type]
- * @param {number} [code]
- * @param {number} [subcode]
- * @param {string} [traceID]
- * @access public
- */
-function FacebookTokenError(message, type, code, subcode, traceID) {
- Error.call(this);
- Error.captureStackTrace(this, arguments.callee);
- this.name = 'FacebookTokenError';
- this.message = message;
- this.type = type;
- this.code = code;
- this.subcode = subcode;
- this.traceID = traceID;
- this.status = 500;
-}
-
-// Inherit from `Error`.
-FacebookTokenError.prototype.__proto__ = Error.prototype;
-
-
-// Expose constructor.
-module.exports = FacebookTokenError;
diff --git a/node_modules/passport-facebook/lib/index.js b/node_modules/passport-facebook/lib/index.js
deleted file mode 100644
index af2282d..0000000
--- a/node_modules/passport-facebook/lib/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// Load modules.
-var Strategy = require('./strategy');
-
-
-// Expose Strategy.
-exports = module.exports = Strategy;
-
-// Exports.
-exports.Strategy = Strategy;
diff --git a/node_modules/passport-facebook/lib/profile.js b/node_modules/passport-facebook/lib/profile.js
deleted file mode 100644
index ef00860..0000000
--- a/node_modules/passport-facebook/lib/profile.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Parse profile.
- *
- * @param {object|string} json
- * @return {object}
- * @access public
- */
-exports.parse = function(json) {
- if ('string' == typeof json) {
- json = JSON.parse(json);
- }
-
- var profile = {};
- profile.id = json.id;
- profile.username = json.username;
- profile.displayName = json.name;
- profile.name = { familyName: json.last_name,
- givenName: json.first_name,
- middleName: json.middle_name };
-
- profile.gender = json.gender;
- profile.profileUrl = json.link;
-
- if (json.email) {
- profile.emails = [{ value: json.email }];
- }
-
- if (json.picture) {
- if (typeof json.picture == 'object' && json.picture.data) {
- // October 2012 Breaking Changes
- profile.photos = [{ value: json.picture.data.url }];
- } else {
- profile.photos = [{ value: json.picture }];
- }
- }
-
- return profile;
-};
diff --git a/node_modules/passport-facebook/lib/strategy.js b/node_modules/passport-facebook/lib/strategy.js
deleted file mode 100644
index f7881b1..0000000
--- a/node_modules/passport-facebook/lib/strategy.js
+++ /dev/null
@@ -1,240 +0,0 @@
-// Load modules.
-var OAuth2Strategy = require('passport-oauth2')
- , util = require('util')
- , uri = require('url')
- , crypto = require('crypto')
- , Profile = require('./profile')
- , InternalOAuthError = require('passport-oauth2').InternalOAuthError
- , FacebookAuthorizationError = require('./errors/facebookauthorizationerror')
- , FacebookTokenError = require('./errors/facebooktokenerror')
- , FacebookGraphAPIError = require('./errors/facebookgraphapierror');
-
-
-/**
- * `Strategy` constructor.
- *
- * The Facebook authentication strategy authenticates requests by delegating to
- * Facebook using the OAuth 2.0 protocol.
- *
- * Applications must supply a `verify` callback which accepts an `accessToken`,
- * `refreshToken` and service-specific `profile`, and then calls the `cb`
- * callback supplying a `user`, which should be set to `false` if the
- * credentials are not valid. If an exception occured, `err` should be set.
- *
- * Options:
- * - `clientID` your Facebook application's App ID
- * - `clientSecret` your Facebook application's App Secret
- * - `callbackURL` URL to which Facebook will redirect the user after granting authorization
- *
- * Examples:
- *
- * passport.use(new FacebookStrategy({
- * clientID: '123-456-789',
- * clientSecret: 'shhh-its-a-secret'
- * callbackURL: 'https://www.example.net/auth/facebook/callback'
- * },
- * function(accessToken, refreshToken, profile, cb) {
- * User.findOrCreate(..., function (err, user) {
- * cb(err, user);
- * });
- * }
- * ));
- *
- * @constructor
- * @param {object} options
- * @param {function} verify
- * @access public
- */
-function Strategy(options, verify) {
- options = options || {};
- options.authorizationURL = options.authorizationURL || 'https://www.facebook.com/dialog/oauth';
- options.tokenURL = options.tokenURL || 'https://graph.facebook.com/oauth/access_token';
- options.scopeSeparator = options.scopeSeparator || ',';
-
- OAuth2Strategy.call(this, options, verify);
- this.name = 'facebook';
- this._profileURL = options.profileURL || 'https://graph.facebook.com/v2.5/me';
- this._profileFields = options.profileFields || null;
- this._enableProof = options.enableProof;
- this._clientSecret = options.clientSecret;
-}
-
-// Inherit from `OAuth2Strategy`.
-util.inherits(Strategy, OAuth2Strategy);
-
-
-/**
- * Authenticate request by delegating to Facebook using OAuth 2.0.
- *
- * @param {http.IncomingMessage} req
- * @param {object} options
- * @access protected
- */
-Strategy.prototype.authenticate = function(req, options) {
- // Facebook doesn't conform to the OAuth 2.0 specification, with respect to
- // redirecting with error codes.
- //
- // FIX: https://github.com/jaredhanson/passport-oauth/issues/16
- if (req.query && req.query.error_code && !req.query.error) {
- return this.error(new FacebookAuthorizationError(req.query.error_message, parseInt(req.query.error_code, 10)));
- }
-
- OAuth2Strategy.prototype.authenticate.call(this, req, options);
-};
-
-/**
- * Return extra Facebook-specific parameters to be included in the authorization
- * request.
- *
- * Options:
- * - `display` Display mode to render dialog, { `page`, `popup`, `touch` }.
- *
- * @param {object} options
- * @return {object}
- * @access protected
- */
-Strategy.prototype.authorizationParams = function (options) {
- var params = {};
-
- // https://developers.facebook.com/docs/reference/dialogs/oauth/
- if (options.display) {
- params.display = options.display;
- }
-
- // https://developers.facebook.com/docs/facebook-login/reauthentication/
- if (options.authType) {
- params.auth_type = options.authType;
- }
- if (options.authNonce) {
- params.auth_nonce = options.authNonce;
- }
-
- return params;
-};
-
-/**
- * Retrieve user profile from Facebook.
- *
- * This function constructs a normalized profile, with the following properties:
- *
- * - `provider` always set to `facebook`
- * - `id` the user's Facebook ID
- * - `username` the user's Facebook username
- * - `displayName` the user's full name
- * - `name.familyName` the user's last name
- * - `name.givenName` the user's first name
- * - `name.middleName` the user's middle name
- * - `gender` the user's gender: `male` or `female`
- * - `profileUrl` the URL of the profile for the user on Facebook
- * - `emails` the proxied or contact email address granted by the user
- *
- * @param {string} accessToken
- * @param {function} done
- * @access protected
- */
-Strategy.prototype.userProfile = function(accessToken, done) {
- var url = uri.parse(this._profileURL);
- if (this._enableProof) {
- // Secure API call by adding proof of the app secret. This is required when
- // the "Require AppSecret Proof for Server API calls" setting has been
- // enabled. The proof is a SHA256 hash of the access token, using the app
- // secret as the key.
- //
- // For further details, refer to:
- // https://developers.facebook.com/docs/reference/api/securing-graph-api/
- var proof = crypto.createHmac('sha256', this._clientSecret).update(accessToken).digest('hex');
- url.search = (url.search ? url.search + '&' : '') + 'appsecret_proof=' + proof;
- }
- if (this._profileFields) {
- var fields = this._convertProfileFields(this._profileFields);
- if (fields !== '') { url.search = (url.search ? url.search + '&' : '') + 'fields=' + fields; }
- }
- url = uri.format(url);
-
- this._oauth2.get(url, accessToken, function (err, body, res) {
- var json;
-
- if (err) {
- if (err.data) {
- try {
- json = JSON.parse(err.data);
- } catch (_) {}
- }
-
- if (json && json.error && typeof json.error == 'object') {
- return done(new FacebookGraphAPIError(json.error.message, json.error.type, json.error.code, json.error.error_subcode, json.error.fbtrace_id));
- }
- return done(new InternalOAuthError('Failed to fetch user profile', err));
- }
-
- try {
- json = JSON.parse(body);
- } catch (ex) {
- return done(new Error('Failed to parse user profile'));
- }
-
- var profile = Profile.parse(json);
- profile.provider = 'facebook';
- profile._raw = body;
- profile._json = json;
-
- done(null, profile);
- });
-};
-
-/**
- * Parse error response from Facebook OAuth 2.0 token endpoint.
- *
- * @param {string} body
- * @param {number} status
- * @return {Error}
- * @access protected
- */
-Strategy.prototype.parseErrorResponse = function(body, status) {
- var json = JSON.parse(body);
- if (json.error && typeof json.error == 'object') {
- return new FacebookTokenError(json.error.message, json.error.type, json.error.code, json.error.error_subcode, json.error.fbtrace_id);
- }
- return OAuth2Strategy.prototype.parseErrorResponse.call(this, body, status);
-};
-
-/**
- * Convert Facebook profile to a normalized profile.
- *
- * @param {object} profileFields
- * @return {string}
- * @access protected
- */
-Strategy.prototype._convertProfileFields = function(profileFields) {
- var map = {
- 'id': 'id',
- 'username': 'username',
- 'displayName': 'name',
- 'name': ['last_name', 'first_name', 'middle_name'],
- 'gender': 'gender',
- 'birthday': 'birthday',
- 'profileUrl': 'link',
- 'emails': 'email',
- 'photos': 'picture'
- };
-
- var fields = [];
-
- profileFields.forEach(function(f) {
- // return raw Facebook profile field to support the many fields that don't
- // map cleanly to Portable Contacts
- if (typeof map[f] === 'undefined') { return fields.push(f); };
-
- if (Array.isArray(map[f])) {
- Array.prototype.push.apply(fields, map[f]);
- } else {
- fields.push(map[f]);
- }
- });
-
- return fields.join(',');
-};
-
-
-// Expose constructor.
-module.exports = Strategy;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/.npmignore b/node_modules/passport-facebook/node_modules/passport-oauth2/.npmignore
deleted file mode 100644
index a50451d..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/.npmignore
+++ /dev/null
@@ -1,8 +0,0 @@
-Makefile
-docs/
-examples/
-reports/
-test/
-
-.jshintrc
-.travis.yml
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/LICENSE b/node_modules/passport-facebook/node_modules/passport-oauth2/LICENSE
deleted file mode 100644
index 0554e9e..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2011-2016 Jared Hanson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/README.md b/node_modules/passport-facebook/node_modules/passport-oauth2/README.md
deleted file mode 100644
index b996c3b..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/README.md
+++ /dev/null
@@ -1,124 +0,0 @@
-# passport-oauth2
-
-[![Build](https://img.shields.io/travis/jaredhanson/passport-oauth2.svg)](https://travis-ci.org/jaredhanson/passport-oauth2)
-[![Coverage](https://img.shields.io/coveralls/jaredhanson/passport-oauth2.svg)](https://coveralls.io/r/jaredhanson/passport-oauth2)
-[![Quality](https://img.shields.io/codeclimate/github/jaredhanson/passport-oauth2.svg?label=quality)](https://codeclimate.com/github/jaredhanson/passport-oauth2)
-[![Dependencies](https://img.shields.io/david/jaredhanson/passport-oauth2.svg)](https://david-dm.org/jaredhanson/passport-oauth2)
-
-
-General-purpose OAuth 2.0 authentication strategy for [Passport](http://passportjs.org/).
-
-This module lets you authenticate using OAuth 2.0 in your Node.js applications.
-By plugging into Passport, OAuth 2.0 authentication can be easily and
-unobtrusively integrated into any application or framework that supports
-[Connect](http://www.senchalabs.org/connect/)-style middleware, including
-[Express](http://expressjs.com/).
-
-Note that this strategy provides generic OAuth 2.0 support. In many cases, a
-provider-specific strategy can be used instead, which cuts down on unnecessary
-configuration, and accommodates any provider-specific quirks. See the
-[list](https://github.com/jaredhanson/passport/wiki/Strategies) for supported
-providers.
-
-Developers who need to implement authentication against an OAuth 2.0 provider
-that is not already supported are encouraged to sub-class this strategy. If you
-choose to open source the new provider-specific strategy, please add it to the
-list so other people can find it.
-
-## Install
-
- $ npm install passport-oauth2
-
-## Usage
-
-#### Configure Strategy
-
-The OAuth 2.0 authentication strategy authenticates users using a third-party
-account and OAuth 2.0 tokens. The provider's OAuth 2.0 endpoints, as well as
-the client identifer and secret, are specified as options. The strategy
-requires a `verify` callback, which receives an access token and profile,
-and calls `cb` providing a user.
-
-```js
-passport.use(new OAuth2Strategy({
- authorizationURL: 'https://www.example.com/oauth2/authorize',
- tokenURL: 'https://www.example.com/oauth2/token',
- clientID: EXAMPLE_CLIENT_ID,
- clientSecret: EXAMPLE_CLIENT_SECRET,
- callbackURL: "http://localhost:3000/auth/example/callback"
- },
- function(accessToken, refreshToken, profile, cb) {
- User.findOrCreate({ exampleId: profile.id }, function (err, user) {
- return cb(err, user);
- });
- }
-));
-```
-
-#### Authenticate Requests
-
-Use `passport.authenticate()`, specifying the `'oauth2'` strategy, to
-authenticate requests.
-
-For example, as route middleware in an [Express](http://expressjs.com/)
-application:
-
-```js
-app.get('/auth/example',
- passport.authenticate('oauth2'));
-
-app.get('/auth/example/callback',
- passport.authenticate('oauth2', { failureRedirect: '/login' }),
- function(req, res) {
- // Successful authentication, redirect home.
- res.redirect('/');
- });
-```
-
-## Related Modules
-
-- [passport-oauth1](https://github.com/jaredhanson/passport-oauth1) — OAuth 1.0 authentication strategy
-- [passport-http-bearer](https://github.com/jaredhanson/passport-http-bearer) — Bearer token authentication strategy for APIs
-- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) — OAuth 2.0 authorization server toolkit
-
-## Contributing
-
-#### Tests
-
-The test suite is located in the `test/` directory. All new features are
-expected to have corresponding test cases. Ensure that the complete test suite
-passes by executing:
-
-```bash
-$ make test
-```
-
-#### Coverage
-
-All new feature development is expected to have test coverage. Patches that
-increse test coverage are happily accepted. Coverage reports can be viewed by
-executing:
-
-```bash
-$ make test-cov
-$ make view-cov
-```
-
-## Support
-
-#### Funding
-
-This software is provided to you as open source, free of charge. The time and
-effort to develop and maintain this project is dedicated by [@jaredhanson](https://github.com/jaredhanson).
-If you (or your employer) benefit from this project, please consider a financial
-contribution. Your contribution helps continue the efforts that produce this
-and other open source software.
-
-Funds are accepted via [PayPal](https://paypal.me/jaredhanson), [Venmo](https://venmo.com/jaredhanson),
-and [other](http://jaredhanson.net/pay) methods. Any amount is appreciated.
-
-## License
-
-[The MIT License](http://opensource.org/licenses/MIT)
-
-Copyright (c) 2011-2016 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/authorizationerror.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/authorizationerror.js
deleted file mode 100644
index 041961d..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/authorizationerror.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * `AuthorizationError` error.
- *
- * AuthorizationError represents an error in response to an authorization
- * request. For details, refer to RFC 6749, section 4.1.2.1.
- *
- * References:
- * - [The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749)
- *
- * @constructor
- * @param {String} [message]
- * @param {String} [code]
- * @param {String} [uri]
- * @param {Number} [status]
- * @api public
- */
-function AuthorizationError(message, code, uri, status) {
- if (!status) {
- switch (code) {
- case 'access_denied': status = 403; break;
- case 'server_error': status = 502; break;
- case 'temporarily_unavailable': status = 503; break;
- }
- }
-
- Error.call(this);
- Error.captureStackTrace(this, this.constructor);
- this.name = this.constructor.name;
- this.message = message;
- this.code = code || 'server_error';
- this.uri = uri;
- this.status = status || 500;
-}
-
-/**
- * Inherit from `Error`.
- */
-AuthorizationError.prototype.__proto__ = Error.prototype;
-
-
-/**
- * Expose `AuthorizationError`.
- */
-module.exports = AuthorizationError;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/internaloautherror.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/internaloautherror.js
deleted file mode 100644
index 5dd6828..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/internaloautherror.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * `InternalOAuthError` error.
- *
- * InternalOAuthError wraps errors generated by node-oauth. By wrapping these
- * objects, error messages can be formatted in a manner that aids in debugging
- * OAuth issues.
- *
- * @constructor
- * @param {String} [message]
- * @param {Object|Error} [err]
- * @api public
- */
-function InternalOAuthError(message, err) {
- Error.call(this);
- Error.captureStackTrace(this, this.constructor);
- this.name = this.constructor.name;
- this.message = message;
- this.oauthError = err;
-}
-
-/**
- * Inherit from `Error`.
- */
-InternalOAuthError.prototype.__proto__ = Error.prototype;
-
-/**
- * Returns a string representing the error.
- *
- * @return {String}
- * @api public
- */
-InternalOAuthError.prototype.toString = function() {
- var m = this.name;
- if (this.message) { m += ': ' + this.message; }
- if (this.oauthError) {
- if (this.oauthError instanceof Error) {
- m = this.oauthError.toString();
- } else if (this.oauthError.statusCode && this.oauthError.data) {
- m += ' (status: ' + this.oauthError.statusCode + ' data: ' + this.oauthError.data + ')';
- }
- }
- return m;
-};
-
-
-/**
- * Expose `InternalOAuthError`.
- */
-module.exports = InternalOAuthError;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/tokenerror.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/tokenerror.js
deleted file mode 100644
index 924ea3b..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/errors/tokenerror.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * `TokenError` error.
- *
- * TokenError represents an error received from a token endpoint. For details,
- * refer to RFC 6749, section 5.2.
- *
- * References:
- * - [The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749)
- *
- * @constructor
- * @param {String} [message]
- * @param {String} [code]
- * @param {String} [uri]
- * @param {Number} [status]
- * @api public
- */
-function TokenError(message, code, uri, status) {
- Error.call(this);
- Error.captureStackTrace(this, this.constructor);
- this.name = this.constructor.name;
- this.message = message;
- this.code = code || 'invalid_request';
- this.uri = uri;
- this.status = status || 500;
-}
-
-/**
- * Inherit from `Error`.
- */
-TokenError.prototype.__proto__ = Error.prototype;
-
-
-/**
- * Expose `TokenError`.
- */
-module.exports = TokenError;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/index.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/index.js
deleted file mode 100644
index b025669..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Load modules.
-var Strategy = require('./strategy')
- , AuthorizationError = require('./errors/authorizationerror')
- , TokenError = require('./errors/tokenerror')
- , InternalOAuthError = require('./errors/internaloautherror');
-
-
-// Expose Strategy.
-exports = module.exports = Strategy;
-
-// Exports.
-exports.Strategy = Strategy;
-
-exports.AuthorizationError = AuthorizationError;
-exports.TokenError = TokenError;
-exports.InternalOAuthError = InternalOAuthError;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/null.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/null.js
deleted file mode 100644
index 80ad17e..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/null.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function NullStore(options) {
-}
-
-NullStore.prototype.store = function(req, cb) {
- cb();
-}
-
-NullStore.prototype.verify = function(req, providedState, cb) {
- cb(null, true);
-}
-
-
-module.exports = NullStore;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/session.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/session.js
deleted file mode 100644
index 1d08789..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/state/session.js
+++ /dev/null
@@ -1,85 +0,0 @@
-var uid = require('uid2');
-
-/**
- * Creates an instance of `SessionStore`.
- *
- * This is the state store implementation for the OAuth2Strategy used when
- * the `state` option is enabled. It generates a random state and stores it in
- * `req.session` and verifies it when the service provider redirects the user
- * back to the application.
- *
- * This state store requires session support. If no session exists, an error
- * will be thrown.
- *
- * Options:
- *
- * - `key` The key in the session under which to store the state
- *
- * @constructor
- * @param {Object} options
- * @api public
- */
-function SessionStore(options) {
- if (!options.key) { throw new TypeError('Session-based state store requires a session key'); }
- this._key = options.key;
-}
-
-/**
- * Store request state.
- *
- * This implementation simply generates a random string and stores the value in
- * the session, where it will be used for verification when the user is
- * redirected back to the application.
- *
- * @param {Object} req
- * @param {Function} callback
- * @api protected
- */
-SessionStore.prototype.store = function(req, callback) {
- if (!req.session) { return callback(new Error('OAuth 2.0 authentication requires session support when using state. Did you forget to use express-session middleware?')); }
-
- var key = this._key;
- var state = uid(24);
- if (!req.session[key]) { req.session[key] = {}; }
- req.session[key].state = state;
- callback(null, state);
-};
-
-/**
- * Verify request state.
- *
- * This implementation simply compares the state parameter in the request to the
- * value generated earlier and stored in the session.
- *
- * @param {Object} req
- * @param {String} providedState
- * @param {Function} callback
- * @api protected
- */
-SessionStore.prototype.verify = function(req, providedState, callback) {
- if (!req.session) { return callback(new Error('OAuth 2.0 authentication requires session support when using state. Did you forget to use express-session middleware?')); }
-
- var key = this._key;
- if (!req.session[key]) {
- return callback(null, false, { message: 'Unable to verify authorization request state.' });
- }
-
- var state = req.session[key].state;
- if (!state) {
- return callback(null, false, { message: 'Unable to verify authorization request state.' });
- }
-
- delete req.session[key].state;
- if (Object.keys(req.session[key]).length === 0) {
- delete req.session[key];
- }
-
- if (state !== providedState) {
- return callback(null, false, { message: 'Invalid authorization request state.' });
- }
-
- return callback(null, true);
-};
-
-// Expose constructor.
-module.exports = SessionStore;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js
deleted file mode 100644
index 01d78b1..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js
+++ /dev/null
@@ -1,376 +0,0 @@
-// Load modules.
-var passport = require('passport-strategy')
- , url = require('url')
- , util = require('util')
- , utils = require('./utils')
- , OAuth2 = require('oauth').OAuth2
- , NullStateStore = require('./state/null')
- , SessionStateStore = require('./state/session')
- , AuthorizationError = require('./errors/authorizationerror')
- , TokenError = require('./errors/tokenerror')
- , InternalOAuthError = require('./errors/internaloautherror');
-
-
-/**
- * Creates an instance of `OAuth2Strategy`.
- *
- * The OAuth 2.0 authentication strategy authenticates requests using the OAuth
- * 2.0 framework.
- *
- * OAuth 2.0 provides a facility for delegated authentication, whereby users can
- * authenticate using a third-party service such as Facebook. Delegating in
- * this manner involves a sequence of events, including redirecting the user to
- * the third-party service for authorization. Once authorization has been
- * granted, the user is redirected back to the application and an authorization
- * code can be used to obtain credentials.
- *
- * Applications must supply a `verify` callback, for which the function
- * signature is:
- *
- * function(accessToken, refreshToken, profile, done) { ... }
- *
- * The verify callback is responsible for finding or creating the user, and
- * invoking `done` with the following arguments:
- *
- * done(err, user, info);
- *
- * `user` should be set to `false` to indicate an authentication failure.
- * Additional `info` can optionally be passed as a third argument, typically
- * used to display informational messages. If an exception occured, `err`
- * should be set.
- *
- * Options:
- *
- * - `authorizationURL` URL used to obtain an authorization grant
- * - `tokenURL` URL used to obtain an access token
- * - `clientID` identifies client to service provider
- * - `clientSecret` secret used to establish ownership of the client identifer
- * - `callbackURL` URL to which the service provider will redirect the user after obtaining authorization
- * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`)
- *
- * Examples:
- *
- * passport.use(new OAuth2Strategy({
- * authorizationURL: 'https://www.example.com/oauth2/authorize',
- * tokenURL: 'https://www.example.com/oauth2/token',
- * clientID: '123-456-789',
- * clientSecret: 'shhh-its-a-secret'
- * callbackURL: 'https://www.example.net/auth/example/callback'
- * },
- * function(accessToken, refreshToken, profile, done) {
- * User.findOrCreate(..., function (err, user) {
- * done(err, user);
- * });
- * }
- * ));
- *
- * @constructor
- * @param {Object} options
- * @param {Function} verify
- * @api public
- */
-function OAuth2Strategy(options, verify) {
- if (typeof options == 'function') {
- verify = options;
- options = undefined;
- }
- options = options || {};
-
- if (!verify) { throw new TypeError('OAuth2Strategy requires a verify callback'); }
- if (!options.authorizationURL) { throw new TypeError('OAuth2Strategy requires a authorizationURL option'); }
- if (!options.tokenURL) { throw new TypeError('OAuth2Strategy requires a tokenURL option'); }
- if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
-
- passport.Strategy.call(this);
- this.name = 'oauth2';
- this._verify = verify;
-
- // NOTE: The _oauth2 property is considered "protected". Subclasses are
- // allowed to use it when making protected resource requests to retrieve
- // the user profile.
- this._oauth2 = new OAuth2(options.clientID, options.clientSecret,
- '', options.authorizationURL, options.tokenURL, options.customHeaders);
-
- this._callbackURL = options.callbackURL;
- this._scope = options.scope;
- this._scopeSeparator = options.scopeSeparator || ' ';
- this._key = options.sessionKey || ('oauth2:' + url.parse(options.authorizationURL).hostname);
-
- if (options.store) {
- this._stateStore = options.store;
- } else {
- if (options.state) {
- this._stateStore = new SessionStateStore({ key: this._key });
- } else {
- this._stateStore = new NullStateStore();
- }
- }
- this._trustProxy = options.proxy;
- this._passReqToCallback = options.passReqToCallback;
- this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile;
-}
-
-// Inherit from `passport.Strategy`.
-util.inherits(OAuth2Strategy, passport.Strategy);
-
-
-/**
- * Authenticate request by delegating to a service provider using OAuth 2.0.
- *
- * @param {Object} req
- * @api protected
- */
-OAuth2Strategy.prototype.authenticate = function(req, options) {
- options = options || {};
- var self = this;
-
- if (req.query && req.query.error) {
- if (req.query.error == 'access_denied') {
- return this.fail({ message: req.query.error_description });
- } else {
- return this.error(new AuthorizationError(req.query.error_description, req.query.error, req.query.error_uri));
- }
- }
-
- var callbackURL = options.callbackURL || this._callbackURL;
- if (callbackURL) {
- var parsed = url.parse(callbackURL);
- if (!parsed.protocol) {
- // The callback URL is relative, resolve a fully qualified URL from the
- // URL of the originating request.
- callbackURL = url.resolve(utils.originalURL(req, { proxy: this._trustProxy }), callbackURL);
- }
- }
-
- var meta = {
- authorizationURL: this._oauth2._authorizeUrl,
- tokenURL: this._oauth2._accessTokenUrl,
- clientID: this._oauth2._clientId
- }
-
- if (req.query && req.query.code) {
- function loaded(err, ok, state) {
- if (err) { return self.error(err); }
- if (!ok) {
- return self.fail(state, 403);
- }
-
- var code = req.query.code;
-
- var params = self.tokenParams(options);
- params.grant_type = 'authorization_code';
- if (callbackURL) { params.redirect_uri = callbackURL; }
-
- self._oauth2.getOAuthAccessToken(code, params,
- function(err, accessToken, refreshToken, params) {
- if (err) { return self.error(self._createOAuthError('Failed to obtain access token', err)); }
-
- self._loadUserProfile(accessToken, function(err, profile) {
- if (err) { return self.error(err); }
-
- function verified(err, user, info) {
- if (err) { return self.error(err); }
- if (!user) { return self.fail(info); }
-
- info = info || {};
- if (state) { info.state = state; }
- self.success(user, info);
- }
-
- try {
- if (self._passReqToCallback) {
- var arity = self._verify.length;
- if (arity == 6) {
- self._verify(req, accessToken, refreshToken, params, profile, verified);
- } else { // arity == 5
- self._verify(req, accessToken, refreshToken, profile, verified);
- }
- } else {
- var arity = self._verify.length;
- if (arity == 5) {
- self._verify(accessToken, refreshToken, params, profile, verified);
- } else { // arity == 4
- self._verify(accessToken, refreshToken, profile, verified);
- }
- }
- } catch (ex) {
- return self.error(ex);
- }
- });
- }
- );
- }
-
- var state = req.query.state;
- try {
- var arity = this._stateStore.verify.length;
- if (arity == 4) {
- this._stateStore.verify(req, state, meta, loaded);
- } else { // arity == 3
- this._stateStore.verify(req, state, loaded);
- }
- } catch (ex) {
- return this.error(ex);
- }
- } else {
- var params = this.authorizationParams(options);
- params.response_type = 'code';
- if (callbackURL) { params.redirect_uri = callbackURL; }
- var scope = options.scope || this._scope;
- if (scope) {
- if (Array.isArray(scope)) { scope = scope.join(this._scopeSeparator); }
- params.scope = scope;
- }
-
- var state = options.state;
- if (state) {
- params.state = state;
- var location = this._oauth2.getAuthorizeUrl(params);
- this.redirect(location);
- } else {
- function stored(err, state) {
- if (err) { return self.error(err); }
-
- if (state) { params.state = state; }
- var location = self._oauth2.getAuthorizeUrl(params);
- self.redirect(location);
- }
-
- try {
- var arity = this._stateStore.store.length;
- if (arity == 3) {
- this._stateStore.store(req, meta, stored);
- } else { // arity == 2
- this._stateStore.store(req, stored);
- }
- } catch (ex) {
- return this.error(ex);
- }
- }
- }
-};
-
-/**
- * Retrieve user profile from service provider.
- *
- * OAuth 2.0-based authentication strategies can overrride this function in
- * order to load the user's profile from the service provider. This assists
- * applications (and users of those applications) in the initial registration
- * process by automatically submitting required information.
- *
- * @param {String} accessToken
- * @param {Function} done
- * @api protected
- */
-OAuth2Strategy.prototype.userProfile = function(accessToken, done) {
- return done(null, {});
-};
-
-/**
- * Return extra parameters to be included in the authorization request.
- *
- * Some OAuth 2.0 providers allow additional, non-standard parameters to be
- * included when requesting authorization. Since these parameters are not
- * standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication
- * strategies can overrride this function in order to populate these parameters
- * as required by the provider.
- *
- * @param {Object} options
- * @return {Object}
- * @api protected
- */
-OAuth2Strategy.prototype.authorizationParams = function(options) {
- return {};
-};
-
-/**
- * Return extra parameters to be included in the token request.
- *
- * Some OAuth 2.0 providers allow additional, non-standard parameters to be
- * included when requesting an access token. Since these parameters are not
- * standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication
- * strategies can overrride this function in order to populate these parameters
- * as required by the provider.
- *
- * @return {Object}
- * @api protected
- */
-OAuth2Strategy.prototype.tokenParams = function(options) {
- return {};
-};
-
-/**
- * Parse error response from OAuth 2.0 endpoint.
- *
- * OAuth 2.0-based authentication strategies can overrride this function in
- * order to parse error responses received from the token endpoint, allowing the
- * most informative message to be displayed.
- *
- * If this function is not overridden, the body will be parsed in accordance
- * with RFC 6749, section 5.2.
- *
- * @param {String} body
- * @param {Number} status
- * @return {Error}
- * @api protected
- */
-OAuth2Strategy.prototype.parseErrorResponse = function(body, status) {
- var json = JSON.parse(body);
- if (json.error) {
- return new TokenError(json.error_description, json.error, json.error_uri);
- }
- return null;
-};
-
-/**
- * Load user profile, contingent upon options.
- *
- * @param {String} accessToken
- * @param {Function} done
- * @api private
- */
-OAuth2Strategy.prototype._loadUserProfile = function(accessToken, done) {
- var self = this;
-
- function loadIt() {
- return self.userProfile(accessToken, done);
- }
- function skipIt() {
- return done(null);
- }
-
- if (typeof this._skipUserProfile == 'function' && this._skipUserProfile.length > 1) {
- // async
- this._skipUserProfile(accessToken, function(err, skip) {
- if (err) { return done(err); }
- if (!skip) { return loadIt(); }
- return skipIt();
- });
- } else {
- var skip = (typeof this._skipUserProfile == 'function') ? this._skipUserProfile() : this._skipUserProfile;
- if (!skip) { return loadIt(); }
- return skipIt();
- }
-};
-
-/**
- * Create an OAuth error.
- *
- * @param {String} message
- * @param {Object|Error} err
- * @api private
- */
-OAuth2Strategy.prototype._createOAuthError = function(message, err) {
- var e;
- if (err.statusCode && err.data) {
- try {
- e = this.parseErrorResponse(err.data, err.statusCode);
- } catch (_) {}
- }
- if (!e) { e = new InternalOAuthError(message, err); }
- return e;
-};
-
-
-// Expose constructor.
-module.exports = OAuth2Strategy;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/utils.js b/node_modules/passport-facebook/node_modules/passport-oauth2/lib/utils.js
deleted file mode 100644
index 493300a..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/lib/utils.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Reconstructs the original URL of the request.
- *
- * This function builds a URL that corresponds the original URL requested by the
- * client, including the protocol (http or https) and host.
- *
- * If the request passed through any proxies that terminate SSL, the
- * `X-Forwarded-Proto` header is used to detect if the request was encrypted to
- * the proxy, assuming that the proxy has been flagged as trusted.
- *
- * @param {http.IncomingMessage} req
- * @param {Object} [options]
- * @return {String}
- * @api private
- */
-exports.originalURL = function(req, options) {
- options = options || {};
- var app = req.app;
- if (app && app.get && app.get('trust proxy')) {
- options.proxy = true;
- }
- var trustProxy = options.proxy;
-
- var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
- , tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0])
- , host = (trustProxy && req.headers['x-forwarded-host']) || req.headers.host
- , protocol = tls ? 'https' : 'http'
- , path = req.url || '';
- return protocol + '://' + host + path;
-};
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/.npmignore b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/.npmignore
deleted file mode 100644
index 3c3629e..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/LICENSE b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/LICENSE
deleted file mode 100644
index f8049f8..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/LICENSE
+++ /dev/null
@@ -1,8 +0,0 @@
-The MIT License (MIT)
-Copyright (c) <2010-2012> <Ciaran Jessup>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Makefile b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Makefile
deleted file mode 100644
index 7723a39..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Run all tests
-#
-test:
- @@node_modules/.bin/vows tests/*tests.js --spec
-
-.PHONY: test install
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Readme.md b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Readme.md
deleted file mode 100644
index 8913210..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/Readme.md
+++ /dev/null
@@ -1,187 +0,0 @@
-node-oauth
-===========
-A simple oauth API for node.js . This API allows users to authenticate against OAUTH providers, and thus act as OAuth consumers. It also has support for OAuth Echo, which is used for communicating with 3rd party media providers such as TwitPic and yFrog.
-
-Tested against Twitter (http://twitter.com), term.ie (http://term.ie/oauth/example/), TwitPic, and Yahoo!
-
-Also provides rudimentary OAuth2 support, tested against facebook, github, foursquare, google and Janrain. For more complete usage examples please take a look at connect-auth (http://github.com/ciaranj/connect-auth)
-
-[![Clone in Koding](http://learn.koding.com/btn/clone_d.png)][koding]
-[koding]: https://koding.com/Teamwork?import=https://github.com/ciaranj/node-oauth/archive/master.zip&c=git1
-[![Pair on Thinkful](https://tf-assets-staging.s3.amazonaws.com/badges/thinkful_repo_badge.svg)][Thinkful]
-[Thinkful]: http://start.thinkful.com/node/?utm_source=github&utm_medium=badge&utm_campaign=node-oauth
-
-Installation
-==============
-
- $ npm install oauth
-
-
-Examples
-==========
-
-To run examples/tests install Mocha `$ npm install -g mocha` and run `$ mocha you-file-name.js`:
-
-## OAuth1.0
-
-```javascript
-describe('OAuth1.0',function(){
- var OAuth = require('oauth');
-
- it('tests trends Twitter API v1.1',function(done){
- var oauth = new OAuth.OAuth(
- 'https://api.twitter.com/oauth/request_token',
- 'https://api.twitter.com/oauth/access_token',
- 'your application consumer key',
- 'your application secret',
- '1.0A',
- null,
- 'HMAC-SHA1'
- );
- oauth.get(
- 'https://api.twitter.com/1.1/trends/place.json?id=23424977',
- 'your user token for this app', //test user token
- 'your user secret for this app', //test user secret
- function (e, data, res){
- if (e) console.error(e);
- console.log(require('util').inspect(data));
- done();
- });
- });
-});
-```
-
-## OAuth2.0
-```javascript
-describe('OAuth2',function(){
- var OAuth = require('oauth');
-
- it('gets bearer token', function(done){
- var OAuth2 = OAuth.OAuth2;
- var twitterConsumerKey = 'your key';
- var twitterConsumerSecret = 'your secret';
- var oauth2 = new OAuth2(server.config.keys.twitter.consumerKey,
- twitterConsumerSecret,
- 'https://api.twitter.com/',
- null,
- 'oauth2/token',
- null);
- oauth2.getOAuthAccessToken(
- '',
- {'grant_type':'client_credentials'},
- function (e, access_token, refresh_token, results){
- console.log('bearer: ',access_token);
- done();
- });
- });
-```
-
-Change History
-==============
-* 0.9.14
- - OAuth2: Extend 'successful' token responses to include anything in the 2xx range.
-* 0.9.13
- - OAuth2: Fixes the "createCredentials() is deprecated, use tls.createSecureContext instead" message. (thank you AJ ONeal)
-* 0.9.12
- - OAuth1/2: Can now pass Buffer instance directly for PUTs+POSTs (thank you Evan Prodromou)
- - OAuth1: Improve interoperability with libraries that mess with the prototype. (thank you Jose Ignacio Andres)
- - OAuth2: Adds PUT support for OAuth2 (thank you Derek Brooks)
- - OAuth1: Improves use_strict compatibility (thank you Ted Goddard)
-* 0.9.11
- - OAuth2: No longer sends the type=webserver argument with the OAuth2 requests (thank you bendiy)
- - OAuth2: Provides a default (and overrideable) User-Agent header (thanks to Andrew Martens & Daniel Mahlow)
- - OAuth1: New followRedirects client option (true by default) (thanks to Pieter Joost van de Sande)
- - OAuth1: Adds RSA-SHA1 support (thanks to Jeffrey D. Van Alstine & Michael Garvin & Andreas Knecht)
-* 0.9.10
- - OAuth2: Addresses 2 issues that came in with 0.9.9, #129 & #125 (thank you José F. Romaniello)
-* 0.9.9
- - OAuth1: Fix the mismatch between the output of querystring.stringify() and this._encodeData(). (thank you rolandboon)
- - OAuth2: Adds Authorization Header and supports extra headers by default ( thanks to Brian Park)
-* 0.9.8
- - OAuth1: Support overly-strict OAuth server's that require whitespace separating the Authorization Header parameters (e.g. 500px.com) (Thanks to Christian Schwarz)
- - OAuth1: Fix incorrect double-encoding of PLAINTEXT OAuth connections (Thanks to Joe Rozner)
- - OAuth1: Minor safety check added when checking hostnames. (Thanks to Garrick Cheung)
-* 0.9.7
- - OAuth2: Pass back any extra response data for calls to getOAuthAccessToken (Thanks to Tang Bo Hao)
- - OAuth2: Don't force a https request if given a http url (Thanks to Damien Mathieu)
- - OAuth2: Supports specifying a grant-type of 'refresh-token' (Thanks to Luke Baker)
-* 0.9.6
- - OAuth2: Support for 302 redirects (Thanks Patrick Negri).
- - OAuth1/2: Some code tidying. ( Thanks to Raoul Millais )
-* 0.9.5
- - OAuth1: Allow usage of HTTP verbs other than GET for retrieving the access and request tokens (Thanks to Raoul Millais)
-* 0.9.4
- - OAuth1/2: Support for OAuth providers that drop connections (don't send response lengths? [Google])
- - OAuth2: Change getOAuthAccessToken to POST rather than GET ( Possible Breaking change!!! ... re-tested against Google, Github, Facebook, FourSquare and Janrain and seems ok .. is closer to the spec (v20) )
-* 0.9.3
- - OAuth1: Adds support for following 301 redirects (Thanks bdickason)
-* 0.9.2
- - OAuth1: Correct content length calculated for non-ascii post bodies (Thanks selead)
- - OAuth1: Allowed for configuration of the 'access token' name used when requesting protected resources (OAuth2)
-* 0.9.1
- - OAuth1: Added support for automatically following 302 redirects (Thanks neyric)
- - OAuth1: Added support for OAuth Echo (Thanks Ryan LeFevre).
- - OAuth1: Improved handling of 2xx responses (Thanks Neil Mansilla).
-* 0.9.0
- - OAuth1/2: Compatibility fixes to bring node-oauth up to speed with node.js 0.4x [thanks to Rasmus Andersson for starting the work ]
-* 0.8.4
- - OAuth1: Fixed issue #14 (Parameter ordering ignored encodings).
- - OAuth1: Added support for repeated parameter names.
- - OAuth1/2: Implements issue #15 (Use native SHA1 if available, 10x speed improvement!).
- - OAuth2: Fixed issue #16 (Should use POST when requesting access tokens.).
- - OAuth2: Fixed Issue #17 (OAuth2 spec compliance).
- - OAuth1: Implemented enhancement #13 (Adds support for PUT & DELETE http verbs).
- - OAuth1: Fixes issue #18 (Complex/Composite url arguments [thanks novemberborn])
-* 0.8.3
- - OAuth1: Fixed an issue where the auth header code depended on the Array's toString method (Yohei Sasaki) Updated the getOAuthRequestToken method so we can access google's OAuth secured methods. Also re-implemented and fleshed out the test suite.
-* 0.8.2
- - OAuth1: The request returning methods will now write the POST body if provided (Chris Anderson), the code responsible for manipulating the headers is a bit safe now when working with other code (Paul McKellar)
- - Package: Tweaked the package.json to use index.js instead of main.js
-* 0.8.1
- - OAuth1: Added mechanism to get hold of a signed Node Request object, ready for attaching response listeners etc. (Perfect for streaming APIs)
-* 0.8.0
- - OAuth1: Standardised method capitalisation, the old getOauthAccessToken is now getOAuthAccessToken (Breaking change to existing code)
-* 0.7.7
- - OAuth1: Looks like non oauth_ parameters where appearing within the Authorization headers, which I believe to be incorrect.
-* 0.7.6
- - OAuth1: Added in oauth_verifier property to getAccessToken required for 1.0A
-* 0.7.5
- - Package: Added in a main.js to simplify the require'ing of OAuth
-* 0.7.4
- - OAuth1: Minor change to add an error listener to the OAuth client (thanks troyk)
-* 0.7.3
- - OAuth2: Now sends a Content-Length Http header to keep nginx happy :)
-* 0.7.2
- - OAuth1: Fixes some broken unit tests!
-* 0.7.0
- - OAuth1/2: Introduces support for HTTPS end points and callback URLS for OAuth 1.0A and Oauth 2 (Please be aware that this was a breaking change to the constructor arguments order)
-
-Contributors (In no particular order)
-=====================================
-
-* Evan Prodromou
-* Jose Ignacio Andres
-* Ted Goddard
-* Derek Brooks
-* Ciaran Jessup - ciaranj@gmail.com
-* Mark Wubben - http://equalmedia.com/
-* Ryan LeFevre - http://meltingice.net
-* Raoul Millais
-* Patrick Negri - http://github.com/pnegri
-* Tang Bo Hao - http://github.com/btspoony
-* Damien Mathieu - http://42.dmathieu.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/
-* rolandboon - http://rolandboon.com
-* Brian Park - http://github.com/yaru22
-* José F. Romaniello - http://github.com/jfromaniello
-* bendiy - https://github.com/bendiy
-* Andrew Martins - http://www.andrewmartens.com
-* Daniel Mahlow - https://github.com/dmahlow
-* Pieter Joost van de Sande - https://github.com/pjvds
-* Jeffrey D. Van Alstine
-* Michael Garvin
-* Andreas Knecht
-* AJ ONeal
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/server.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/server.js
deleted file mode 100644
index 3c7bf7f..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/server.js
+++ /dev/null
@@ -1,168 +0,0 @@
-var express = require('express'),
- OAuth = require('oauth').OAuth,
- querystring = require('querystring');
-
-// Setup the Express.js server
-var app = express.createServer();
-app.use(express.logger());
-app.use(express.bodyParser());
-app.use(express.cookieParser());
-app.use(express.session({
- secret: "skjghskdjfhbqigohqdiouk"
-}));
-
-// Home Page
-app.get('/', function(req, res){
- if(!req.session.oauth_access_token) {
- res.redirect("/google_login");
- }
- else {
- res.redirect("/google_contacts");
- }
-});
-
-// Request an OAuth Request Token, and redirects the user to authorize it
-app.get('/google_login', function(req, res) {
-
- var getRequestTokenUrl = "https://www.google.com/accounts/OAuthGetRequestToken";
-
- // GData specifid: scopes that wa want access to
- var gdataScopes = [
- querystring.escape("https://www.google.com/m8/feeds/"),
- querystring.escape("https://www.google.com/calendar/feeds/")
- ];
-
- var oa = new OAuth(getRequestTokenUrl+"?scope="+gdataScopes.join('+'),
- "https://www.google.com/accounts/OAuthGetAccessToken",
- "anonymous",
- "anonymous",
- "1.0",
- "http://localhost:3000/google_cb"+( req.param('action') && req.param('action') != "" ? "?action="+querystring.escape(req.param('action')) : "" ),
- "HMAC-SHA1");
-
- oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){
- if(error) {
- console.log('error');
- console.log(error);
- }
- else {
- // store the tokens in the session
- req.session.oa = oa;
- req.session.oauth_token = oauth_token;
- req.session.oauth_token_secret = oauth_token_secret;
-
- // redirect the user to authorize the token
- res.redirect("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="+oauth_token);
- }
- })
-
-});
-
-// Callback for the authorization page
-app.get('/google_cb', function(req, res) {
-
- // get the OAuth access token with the 'oauth_verifier' that we received
-
- var oa = new OAuth(req.session.oa._requestUrl,
- req.session.oa._accessUrl,
- req.session.oa._consumerKey,
- req.session.oa._consumerSecret,
- req.session.oa._version,
- req.session.oa._authorize_callback,
- req.session.oa._signatureMethod);
-
- console.log(oa);
-
- oa.getOAuthAccessToken(
- req.session.oauth_token,
- req.session.oauth_token_secret,
- req.param('oauth_verifier'),
- function(error, oauth_access_token, oauth_access_token_secret, results2) {
-
- if(error) {
- console.log('error');
- console.log(error);
- }
- else {
-
- // store the access token in the session
- req.session.oauth_access_token = oauth_access_token;
- req.session.oauth_access_token_secret = oauth_access_token_secret;
-
- res.redirect((req.param('action') && req.param('action') != "") ? req.param('action') : "/google_contacts");
- }
-
- });
-
-});
-
-
-function require_google_login(req, res, next) {
- if(!req.session.oauth_access_token) {
- res.redirect("/google_login?action="+querystring.escape(req.originalUrl));
- return;
- }
- next();
-};
-
-app.get('/google_contacts', require_google_login, function(req, res) {
- var oa = new OAuth(req.session.oa._requestUrl,
- req.session.oa._accessUrl,
- req.session.oa._consumerKey,
- req.session.oa._consumerSecret,
- req.session.oa._version,
- req.session.oa._authorize_callback,
- req.session.oa._signatureMethod);
-
- console.log(oa);
-
- // Example using GData API v3
- // GData Specific Header
- oa._headers['GData-Version'] = '3.0';
-
- oa.getProtectedResource(
- "https://www.google.com/m8/feeds/contacts/default/full?alt=json",
- "GET",
- req.session.oauth_access_token,
- req.session.oauth_access_token_secret,
- function (error, data, response) {
-
- var feed = JSON.parse(data);
-
- res.render('google_contacts.ejs', {
- locals: { feed: feed }
- });
- });
-
-});
-
-app.get('/google_calendars', require_google_login, function(req, res) {
- var oa = new OAuth(req.session.oa._requestUrl,
- req.session.oa._accessUrl,
- req.session.oa._consumerKey,
- req.session.oa._consumerSecret,
- req.session.oa._version,
- req.session.oa._authorize_callback,
- req.session.oa._signatureMethod);
- // Example using GData API v2
- // GData Specific Header
- oa._headers['GData-Version'] = '2';
-
- oa.getProtectedResource(
- "https://www.google.com/calendar/feeds/default/allcalendars/full?alt=jsonc",
- "GET",
- req.session.oauth_access_token,
- req.session.oauth_access_token_secret,
- function (error, data, response) {
-
- var feed = JSON.parse(data);
-
- res.render('google_calendars.ejs', {
- locals: { feed: feed }
- });
- });
-
-});
-
-app.listen(3000);
-console.log("listening on http://localhost:3000");
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs
deleted file mode 100644
index 15b826f..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_calendars.ejs
+++ /dev/null
@@ -1,21 +0,0 @@
-
-<p><a href="/google_contacts">Check google_contacts</a></p>
-
-<h1>Google Calendars</h1>
-
-<% for(var i = 0 ; i < feed.data.items.length ; i++ ) {
-
- var calendar = feed.data.items[i]; %>
-<div>
-
- <h2 style="color:white;background-color:<%= calendar["color"] %>"><%= calendar["title"] %></h2>
-
- <p>canEdit: <%= calendar["canEdit"] %></p>
- <p>accessLevel: <%= calendar["accessLevel"] %></p>
- <p>timeZone: <%= calendar["timeZone"] %></p>
- <p>kind: <%= calendar["kind"] %></p>
- <p>updated: <%= calendar["updated"] %></p>
- <p>created: <%= calendar["created"] %></p>
-
-</div>
-<% } %> \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs
deleted file mode 100644
index a2050b2..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/google_contacts.ejs
+++ /dev/null
@@ -1,24 +0,0 @@
-
-<p><a href="/google_calendars">Check google_calendars</a></p>
-
-<h1>Google Contacts</h1>
-
-<% for(var i = 0 ; i < feed.feed.entry.length ; i++ ) {
-
- var contact = feed.feed.entry[i]; %>
-
-<div>
- <!-- you can access much more ! Just a sample: -->
- <%= contact["title"]["$t"] %>
- <% emails = contact["gd$email"] %>
-
- <ul>
- <% for(var j = 0 ; j < emails.length ; j++) { %>
- <li><%= emails[j]["address" ]%></li>
- <% } %>
- </ul>
-
-</div>
-
-
-<% } %>
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/layout.ejs b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/layout.ejs
deleted file mode 100644
index 8d1ac6d..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/express-gdata/views/layout.ejs
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
-<head>
-</head>
-<body>
-
-<%- body %>
-
-</body>
-</html> \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/github-example.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/github-example.js
deleted file mode 100644
index 1a388bd..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/github-example.js
+++ /dev/null
@@ -1,73 +0,0 @@
-var http = require('http');
-var qs = require('querystring');
-// var OAuth = require('oauth'), OAuth2 = OAuth.OAuth2;
-var OAuth2 = require('../lib/oauth2.js').OAuth2;
-
-var clientID = '';
-var clientSecret = '';
-var oauth2 = new OAuth2(clientID,
- clientSecret,
- 'https://github.com/',
- 'login/oauth/authorize',
- 'login/oauth/access_token',
- null); /** Custom headers */
-
-http.createServer(function (req, res) {
- var p = req.url.split('/');
- pLen = p.length;
-
- /**
- * Authorised url as per github docs:
- * https://developer.github.com/v3/oauth/#redirect-users-to-request-github-access
- *
- * getAuthorizedUrl: https://github.com/ciaranj/node-oauth/blob/master/lib/oauth2.js#L148
- * Adding params to authorize url with fields as mentioned in github docs
- *
- */
- var authURL = oauth2.getAuthorizeUrl({
- redirect_uri: 'http://localhost:8080/code',
- scope: ['repo', 'user'],
- state: 'some random string to protect against cross-site request forgery attacks'
- });
-
-
- /**
- * Creating an anchor with authURL as href and sending as response
- */
- var body = '<a href="' + authURL + '"> Get Code </a>';
- if (pLen === 2 && p[1] === '') {
- res.writeHead(200, {
- 'Content-Length': body.length,
- 'Content-Type': 'text/html' });
- res.end(body);
- } else if (pLen === 2 && p[1].indexOf('code') === 0) {
-
- /** Github sends auth code so that access_token can be obtained */
- var qsObj = {};
-
- /** To obtain and parse code='...' from code?code='...' */
- qsObj = qs.parse(p[1].split('?')[1]);
-
- /** Obtaining access_token */
- oauth2.getOAuthAccessToken(
- qsObj.code,
- {'redirect_uri': 'http://localhost:8080/code/'},
- function (e, access_token, refresh_token, results){
- if (e) {
- console.log(e);
- res.end(e);
- } else if (results.error) {
- console.log(results);
- res.end(JSON.stringify(results));
- }
- else {
- console.log('Obtained access_token: ', access_token);
- res.end( access_token);
- }
- });
-
- } else {
- // Unhandled url
- }
-
-}).listen(8080);
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js
deleted file mode 100644
index 91af05d..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/examples/term.ie.oauth-HMAC-SHA1.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var util= require('util')
-
-var OAuth= require('../lib/oauth').OAuth;
-
-var oa= new OAuth("http://term.ie/oauth/example/request_token.php",
- "http://term.ie/oauth/example/access_token.php",
- "key",
- "secret",
- "1.0",
- null,
- "HMAC-SHA1")
-
-oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){
- if(error) util.puts('error :' + error)
- else {
- util.puts('oauth_token :' + oauth_token)
- util.puts('oauth_token_secret :' + oauth_token_secret)
- util.puts('requestoken results :' + util.inspect(results))
- util.puts("Requesting access token")
- oa.getOAuthAccessToken(oauth_token, oauth_token_secret, function(error, oauth_access_token, oauth_access_token_secret, results2) {
- util.puts('oauth_access_token :' + oauth_access_token)
- util.puts('oauth_token_secret :' + oauth_access_token_secret)
- util.puts('accesstoken results :' + util.inspect(results2))
- util.puts("Requesting access token")
- var data= "";
- oa.getProtectedResource("http://term.ie/oauth/example/echo_api.php?foo=bar&too=roo", "GET", oauth_access_token, oauth_access_token_secret, function (error, data, response) {
- util.puts(data);
- });
- });
- }
-})
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/index.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/index.js
deleted file mode 100644
index e20716d..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.OAuth = require("./lib/oauth").OAuth;
-exports.OAuthEcho = require("./lib/oauth").OAuthEcho;
-exports.OAuth2 = require("./lib/oauth2").OAuth2; \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/_utils.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/_utils.js
deleted file mode 100644
index 69fc300..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/_utils.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// Returns true if this is a host that closes *before* it ends?!?!
-module.exports.isAnEarlyCloseHost= function( hostName ) {
- return hostName && hostName.match(".*google(apis)?.com$")
-} \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth.js
deleted file mode 100644
index 50dccf9..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth.js
+++ /dev/null
@@ -1,581 +0,0 @@
-var crypto= require('crypto'),
- sha1= require('./sha1'),
- http= require('http'),
- https= require('https'),
- URL= require('url'),
- querystring= require('querystring'),
- OAuthUtils= require('./_utils');
-
-exports.OAuth= function(requestUrl, accessUrl, consumerKey, consumerSecret, version, authorize_callback, signatureMethod, nonceSize, customHeaders) {
- this._isEcho = false;
-
- this._requestUrl= requestUrl;
- this._accessUrl= accessUrl;
- this._consumerKey= consumerKey;
- this._consumerSecret= this._encodeData( consumerSecret );
- if (signatureMethod == "RSA-SHA1") {
- this._privateKey = consumerSecret;
- }
- this._version= version;
- if( authorize_callback === undefined ) {
- this._authorize_callback= "oob";
- }
- else {
- this._authorize_callback= authorize_callback;
- }
-
- if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1" && signatureMethod != "RSA-SHA1")
- throw new Error("Un-supported signature method: " + signatureMethod )
- this._signatureMethod= signatureMethod;
- this._nonceSize= nonceSize || 32;
- this._headers= customHeaders || {"Accept" : "*/*",
- "Connection" : "close",
- "User-Agent" : "Node authentication"}
- this._clientOptions= this._defaultClientOptions= {"requestTokenHttpMethod": "POST",
- "accessTokenHttpMethod": "POST",
- "followRedirects": true};
- this._oauthParameterSeperator = ",";
-};
-
-exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) {
- this._isEcho = true;
-
- this._realm= realm;
- this._verifyCredentials = verify_credentials;
- this._consumerKey= consumerKey;
- this._consumerSecret= this._encodeData( consumerSecret );
- if (signatureMethod == "RSA-SHA1") {
- this._privateKey = consumerSecret;
- }
- this._version= version;
-
- if( signatureMethod != "PLAINTEXT" && signatureMethod != "HMAC-SHA1" && signatureMethod != "RSA-SHA1")
- throw new Error("Un-supported signature method: " + signatureMethod );
- this._signatureMethod= signatureMethod;
- this._nonceSize= nonceSize || 32;
- this._headers= customHeaders || {"Accept" : "*/*",
- "Connection" : "close",
- "User-Agent" : "Node authentication"};
- this._oauthParameterSeperator = ",";
-}
-
-exports.OAuthEcho.prototype = exports.OAuth.prototype;
-
-exports.OAuth.prototype._getTimestamp= function() {
- return Math.floor( (new Date()).getTime() / 1000 );
-}
-
-exports.OAuth.prototype._encodeData= function(toEncode){
- if( toEncode == null || toEncode == "" ) return ""
- else {
- var result= encodeURIComponent(toEncode);
- // Fix the mismatch between OAuth's RFC3986's and Javascript's beliefs in what is right and wrong ;)
- return result.replace(/\!/g, "%21")
- .replace(/\'/g, "%27")
- .replace(/\(/g, "%28")
- .replace(/\)/g, "%29")
- .replace(/\*/g, "%2A");
- }
-}
-
-exports.OAuth.prototype._decodeData= function(toDecode) {
- if( toDecode != null ) {
- toDecode = toDecode.replace(/\+/g, " ");
- }
- return decodeURIComponent( toDecode);
-}
-
-exports.OAuth.prototype._getSignature= function(method, url, parameters, tokenSecret) {
- var signatureBase= this._createSignatureBase(method, url, parameters);
- return this._createSignature( signatureBase, tokenSecret );
-}
-
-exports.OAuth.prototype._normalizeUrl= function(url) {
- var parsedUrl= URL.parse(url, true)
- var port ="";
- if( parsedUrl.port ) {
- if( (parsedUrl.protocol == "http:" && parsedUrl.port != "80" ) ||
- (parsedUrl.protocol == "https:" && parsedUrl.port != "443") ) {
- port= ":" + parsedUrl.port;
- }
- }
-
- if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/";
-
- return parsedUrl.protocol + "//" + parsedUrl.hostname + port + parsedUrl.pathname;
-}
-
-// Is the parameter considered an OAuth parameter
-exports.OAuth.prototype._isParameterNameAnOAuthParameter= function(parameter) {
- var m = parameter.match('^oauth_');
- if( m && ( m[0] === "oauth_" ) ) {
- return true;
- }
- else {
- return false;
- }
-};
-
-// build the OAuth request authorization header
-exports.OAuth.prototype._buildAuthorizationHeaders= function(orderedParameters) {
- var authHeader="OAuth ";
- if( this._isEcho ) {
- authHeader += 'realm="' + this._realm + '",';
- }
-
- for( var i= 0 ; i < orderedParameters.length; i++) {
- // Whilst the all the parameters should be included within the signature, only the oauth_ arguments
- // should appear within the authorization header.
- if( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) {
- authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\""+ this._oauthParameterSeperator;
- }
- }
-
- authHeader= authHeader.substring(0, authHeader.length-this._oauthParameterSeperator.length);
- return authHeader;
-}
-
-// Takes an object literal that represents the arguments, and returns an array
-// of argument/value pairs.
-exports.OAuth.prototype._makeArrayOfArgumentsHash= function(argumentsHash) {
- var argument_pairs= [];
- for(var key in argumentsHash ) {
- if (argumentsHash.hasOwnProperty(key)) {
- var value= argumentsHash[key];
- if( Array.isArray(value) ) {
- for(var i=0;i<value.length;i++) {
- argument_pairs[argument_pairs.length]= [key, value[i]];
- }
- }
- else {
- argument_pairs[argument_pairs.length]= [key, value];
- }
- }
- }
- return argument_pairs;
-}
-
-// Sorts the encoded key value pairs by encoded name, then encoded value
-exports.OAuth.prototype._sortRequestParams= function(argument_pairs) {
- // Sort by name, then value.
- argument_pairs.sort(function(a,b) {
- if ( a[0]== b[0] ) {
- return a[1] < b[1] ? -1 : 1;
- }
- else return a[0] < b[0] ? -1 : 1;
- });
-
- return argument_pairs;
-}
-
-exports.OAuth.prototype._normaliseRequestParams= function(args) {
- var argument_pairs= this._makeArrayOfArgumentsHash(args);
- // First encode them #3.4.1.3.2 .1
- for(var i=0;i<argument_pairs.length;i++) {
- argument_pairs[i][0]= this._encodeData( argument_pairs[i][0] );
- argument_pairs[i][1]= this._encodeData( argument_pairs[i][1] );
- }
-
- // Then sort them #3.4.1.3.2 .2
- argument_pairs= this._sortRequestParams( argument_pairs );
-
- // Then concatenate together #3.4.1.3.2 .3 & .4
- var args= "";
- for(var i=0;i<argument_pairs.length;i++) {
- args+= argument_pairs[i][0];
- args+= "="
- args+= argument_pairs[i][1];
- if( i < argument_pairs.length-1 ) args+= "&";
- }
- return args;
-}
-
-exports.OAuth.prototype._createSignatureBase= function(method, url, parameters) {
- url= this._encodeData( this._normalizeUrl(url) );
- parameters= this._encodeData( parameters );
- return method.toUpperCase() + "&" + url + "&" + parameters;
-}
-
-exports.OAuth.prototype._createSignature= function(signatureBase, tokenSecret) {
- if( tokenSecret === undefined ) var tokenSecret= "";
- else tokenSecret= this._encodeData( tokenSecret );
- // consumerSecret is already encoded
- var key= this._consumerSecret + "&" + tokenSecret;
-
- var hash= ""
- if( this._signatureMethod == "PLAINTEXT" ) {
- hash= key;
- }
- else if (this._signatureMethod == "RSA-SHA1") {
- key = this._privateKey || "";
- hash= crypto.createSign("RSA-SHA1").update(signatureBase).sign(key, 'base64');
- }
- else {
- if( crypto.Hmac ) {
- hash = crypto.createHmac("sha1", key).update(signatureBase).digest("base64");
- }
- else {
- hash= sha1.HMACSHA1(key, signatureBase);
- }
- }
- return hash;
-}
-exports.OAuth.prototype.NONCE_CHARS= ['a','b','c','d','e','f','g','h','i','j','k','l','m','n',
- 'o','p','q','r','s','t','u','v','w','x','y','z','A','B',
- 'C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3',
- '4','5','6','7','8','9'];
-
-exports.OAuth.prototype._getNonce= function(nonceSize) {
- var result = [];
- var chars= this.NONCE_CHARS;
- var char_pos;
- var nonce_chars_length= chars.length;
-
- for (var i = 0; i < nonceSize; i++) {
- char_pos= Math.floor(Math.random() * nonce_chars_length);
- result[i]= chars[char_pos];
- }
- return result.join('');
-}
-
-exports.OAuth.prototype._createClient= function( port, hostname, method, path, headers, sslEnabled ) {
- var options = {
- host: hostname,
- port: port,
- path: path,
- method: method,
- headers: headers
- };
- var httpModel;
- if( sslEnabled ) {
- httpModel= https;
- } else {
- httpModel= http;
- }
- return httpModel.request(options);
-}
-
-exports.OAuth.prototype._prepareParameters= function( oauth_token, oauth_token_secret, method, url, extra_params ) {
- var oauthParameters= {
- "oauth_timestamp": this._getTimestamp(),
- "oauth_nonce": this._getNonce(this._nonceSize),
- "oauth_version": this._version,
- "oauth_signature_method": this._signatureMethod,
- "oauth_consumer_key": this._consumerKey
- };
-
- if( oauth_token ) {
- oauthParameters["oauth_token"]= oauth_token;
- }
-
- var sig;
- if( this._isEcho ) {
- sig = this._getSignature( "GET", this._verifyCredentials, this._normaliseRequestParams(oauthParameters), oauth_token_secret);
- }
- else {
- if( extra_params ) {
- for( var key in extra_params ) {
- if (extra_params.hasOwnProperty(key)) oauthParameters[key]= extra_params[key];
- }
- }
- var parsedUrl= URL.parse( url, false );
-
- if( parsedUrl.query ) {
- var key2;
- var extraParameters= querystring.parse(parsedUrl.query);
- for(var key in extraParameters ) {
- var value= extraParameters[key];
- if( typeof value == "object" ){
- // TODO: This probably should be recursive
- for(key2 in value){
- oauthParameters[key + "[" + key2 + "]"] = value[key2];
- }
- } else {
- oauthParameters[key]= value;
- }
- }
- }
-
- sig = this._getSignature( method, url, this._normaliseRequestParams(oauthParameters), oauth_token_secret);
- }
-
- var orderedParameters= this._sortRequestParams( this._makeArrayOfArgumentsHash(oauthParameters) );
- orderedParameters[orderedParameters.length]= ["oauth_signature", sig];
- return orderedParameters;
-}
-
-exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) {
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);
-
- if( !post_content_type ) {
- post_content_type= "application/x-www-form-urlencoded";
- }
- var parsedUrl= URL.parse( url, false );
- if( parsedUrl.protocol == "http:" && !parsedUrl.port ) parsedUrl.port= 80;
- if( parsedUrl.protocol == "https:" && !parsedUrl.port ) parsedUrl.port= 443;
-
- var headers= {};
- var authorization = this._buildAuthorizationHeaders(orderedParameters);
- if ( this._isEcho ) {
- headers["X-Verify-Credentials-Authorization"]= authorization;
- }
- else {
- headers["Authorization"]= authorization;
- }
-
- headers["Host"] = parsedUrl.host
-
- for( var key in this._headers ) {
- if (this._headers.hasOwnProperty(key)) {
- headers[key]= this._headers[key];
- }
- }
-
- // Filter out any passed extra_params that are really to do with OAuth
- for(var key in extra_params) {
- if( this._isParameterNameAnOAuthParameter( key ) ) {
- delete extra_params[key];
- }
- }
-
- if( (method == "POST" || method == "PUT") && ( post_body == null && extra_params != null) ) {
- // Fix the mismatch between the output of querystring.stringify() and this._encodeData()
- post_body= querystring.stringify(extra_params)
- .replace(/\!/g, "%21")
- .replace(/\'/g, "%27")
- .replace(/\(/g, "%28")
- .replace(/\)/g, "%29")
- .replace(/\*/g, "%2A");
- }
-
- if( post_body ) {
- if ( Buffer.isBuffer(post_body) ) {
- headers["Content-length"]= post_body.length;
- } else {
- headers["Content-length"]= Buffer.byteLength(post_body);
- }
- } else {
- headers["Content-length"]= 0;
- }
-
- headers["Content-Type"]= post_content_type;
-
- var path;
- if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/";
- if( parsedUrl.query ) path= parsedUrl.pathname + "?"+ parsedUrl.query ;
- else path= parsedUrl.pathname;
-
- var request;
- if( parsedUrl.protocol == "https:" ) {
- request= this._createClient(parsedUrl.port, parsedUrl.hostname, method, path, headers, true);
- }
- else {
- request= this._createClient(parsedUrl.port, parsedUrl.hostname, method, path, headers);
- }
-
- var clientOptions = this._clientOptions;
- if( callback ) {
- var data="";
- var self= this;
-
- // Some hosts *cough* google appear to close the connection early / send no content-length header
- // allow this behaviour.
- var allowEarlyClose= OAuthUtils.isAnEarlyCloseHost( parsedUrl.hostname );
- var callbackCalled= false;
- var passBackControl = function( response ) {
- if(!callbackCalled) {
- callbackCalled= true;
- if ( response.statusCode >= 200 && response.statusCode <= 299 ) {
- callback(null, data, response);
- } else {
- // Follow 301 or 302 redirects with Location HTTP header
- if((response.statusCode == 301 || response.statusCode == 302) && clientOptions.followRedirects && response.headers && response.headers.location) {
- self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback);
- }
- else {
- callback({ statusCode: response.statusCode, data: data }, data, response);
- }
- }
- }
- }
-
- request.on('response', function (response) {
- response.setEncoding('utf8');
- response.on('data', function (chunk) {
- data+=chunk;
- });
- response.on('end', function () {
- passBackControl( response );
- });
- response.on('close', function () {
- if( allowEarlyClose ) {
- passBackControl( response );
- }
- });
- });
-
- request.on("error", function(err) {
- if(!callbackCalled) {
- callbackCalled= true;
- callback( err )
- }
- });
-
- if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) {
- request.write(post_body);
- }
- request.end();
- }
- else {
- if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) {
- request.write(post_body);
- }
- return request;
- }
-
- return;
-}
-
-exports.OAuth.prototype.setClientOptions= function(options) {
- var key,
- mergedOptions= {},
- hasOwnProperty= Object.prototype.hasOwnProperty;
-
- for( key in this._defaultClientOptions ) {
- if( !hasOwnProperty.call(options, key) ) {
- mergedOptions[key]= this._defaultClientOptions[key];
- } else {
- mergedOptions[key]= options[key];
- }
- }
-
- this._clientOptions= mergedOptions;
-};
-
-exports.OAuth.prototype.getOAuthAccessToken= function(oauth_token, oauth_token_secret, oauth_verifier, callback) {
- var extraParams= {};
- if( typeof oauth_verifier == "function" ) {
- callback= oauth_verifier;
- } else {
- extraParams.oauth_verifier= oauth_verifier;
- }
-
- this._performSecureRequest( oauth_token, oauth_token_secret, this._clientOptions.accessTokenHttpMethod, this._accessUrl, extraParams, null, null, function(error, data, response) {
- if( error ) callback(error);
- else {
- var results= querystring.parse( data );
- var oauth_access_token= results["oauth_token"];
- delete results["oauth_token"];
- var oauth_access_token_secret= results["oauth_token_secret"];
- delete results["oauth_token_secret"];
- callback(null, oauth_access_token, oauth_access_token_secret, results );
- }
- })
-}
-
-// Deprecated
-exports.OAuth.prototype.getProtectedResource= function(url, method, oauth_token, oauth_token_secret, callback) {
- this._performSecureRequest( oauth_token, oauth_token_secret, method, url, null, "", null, callback );
-}
-
-exports.OAuth.prototype.delete= function(url, oauth_token, oauth_token_secret, callback) {
- return this._performSecureRequest( oauth_token, oauth_token_secret, "DELETE", url, null, "", null, callback );
-}
-
-exports.OAuth.prototype.get= function(url, oauth_token, oauth_token_secret, callback) {
- return this._performSecureRequest( oauth_token, oauth_token_secret, "GET", url, null, "", null, callback );
-}
-
-exports.OAuth.prototype._putOrPost= function(method, url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) {
- var extra_params= null;
- if( typeof post_content_type == "function" ) {
- callback= post_content_type;
- post_content_type= null;
- }
- if ( typeof post_body != "string" && !Buffer.isBuffer(post_body) ) {
- post_content_type= "application/x-www-form-urlencoded"
- extra_params= post_body;
- post_body= null;
- }
- return this._performSecureRequest( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback );
-}
-
-
-exports.OAuth.prototype.put= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) {
- return this._putOrPost("PUT", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback);
-}
-
-exports.OAuth.prototype.post= function(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback) {
- return this._putOrPost("POST", url, oauth_token, oauth_token_secret, post_body, post_content_type, callback);
-}
-
-/**
- * Gets a request token from the OAuth provider and passes that information back
- * to the calling code.
- *
- * The callback should expect a function of the following form:
- *
- * function(err, token, token_secret, parsedQueryString) {}
- *
- * This method has optional parameters so can be called in the following 2 ways:
- *
- * 1) Primary use case: Does a basic request with no extra parameters
- * getOAuthRequestToken( callbackFunction )
- *
- * 2) As above but allows for provision of extra parameters to be sent as part of the query to the server.
- * getOAuthRequestToken( extraParams, callbackFunction )
- *
- * N.B. This method will HTTP POST verbs by default, if you wish to override this behaviour you will
- * need to provide a requestTokenHttpMethod option when creating the client.
- *
- **/
-exports.OAuth.prototype.getOAuthRequestToken= function( extraParams, callback ) {
- if( typeof extraParams == "function" ){
- callback = extraParams;
- extraParams = {};
- }
- // Callbacks are 1.0A related
- if( this._authorize_callback ) {
- extraParams["oauth_callback"]= this._authorize_callback;
- }
- this._performSecureRequest( null, null, this._clientOptions.requestTokenHttpMethod, this._requestUrl, extraParams, null, null, function(error, data, response) {
- if( error ) callback(error);
- else {
- var results= querystring.parse(data);
-
- var oauth_token= results["oauth_token"];
- var oauth_token_secret= results["oauth_token_secret"];
- delete results["oauth_token"];
- delete results["oauth_token_secret"];
- callback(null, oauth_token, oauth_token_secret, results );
- }
- });
-}
-
-exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) {
-
- if( method === undefined ) {
- var method= "GET";
- }
-
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
- var parsedUrl= URL.parse( url, false );
-
- 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;
-};
-
-exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method) {
- if( method === undefined ) {
- var method= "GET";
- }
-
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
- return this._buildAuthorizationHeaders(orderedParameters);
-};
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js
deleted file mode 100644
index 94ed662..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js
+++ /dev/null
@@ -1,214 +0,0 @@
-var querystring= require('querystring'),
- crypto= require('crypto'),
- https= require('https'),
- http= require('http'),
- URL= require('url'),
- OAuthUtils= require('./_utils');
-
-exports.OAuth2= function(clientId, clientSecret, baseSite, authorizePath, accessTokenPath, customHeaders) {
- this._clientId= clientId;
- this._clientSecret= clientSecret;
- this._baseSite= baseSite;
- this._authorizeUrl= authorizePath || "/oauth/authorize";
- this._accessTokenUrl= accessTokenPath || "/oauth/access_token";
- this._accessTokenName= "access_token";
- this._authMethod= "Bearer";
- this._customHeaders = customHeaders || {};
- this._useAuthorizationHeaderForGET= false;
-}
-
-// This 'hack' method is required for sites that don't use
-// 'access_token' as the name of the access token (for requests).
-// ( http://tools.ietf.org/html/draft-ietf-oauth-v2-16#section-7 )
-// it isn't clear what the correct value should be atm, so allowing
-// for specific (temporary?) override for now.
-exports.OAuth2.prototype.setAccessTokenName= function ( name ) {
- this._accessTokenName= name;
-}
-
-// Sets the authorization method for Authorization header.
-// e.g. Authorization: Bearer <token> # "Bearer" is the authorization method.
-exports.OAuth2.prototype.setAuthMethod = function ( authMethod ) {
- this._authMethod = authMethod;
-};
-
-
-// If you use the OAuth2 exposed 'get' method (and don't construct your own _request call )
-// this will specify whether to use an 'Authorize' header instead of passing the access_token as a query parameter
-exports.OAuth2.prototype.useAuthorizationHeaderforGET = function(useIt) {
- this._useAuthorizationHeaderForGET= useIt;
-}
-
-exports.OAuth2.prototype._getAccessTokenUrl= function() {
- return this._baseSite + this._accessTokenUrl; /* + "?" + querystring.stringify(params); */
-}
-
-// Build the authorization header. In particular, build the part after the colon.
-// e.g. Authorization: Bearer <token> # Build "Bearer <token>"
-exports.OAuth2.prototype.buildAuthHeader= function(token) {
- return this._authMethod + ' ' + token;
-};
-
-exports.OAuth2.prototype._chooseHttpLibrary= function( parsedUrl ) {
- var http_library= https;
- // As this is OAUth2, we *assume* https unless told explicitly otherwise.
- if( parsedUrl.protocol != "https:" ) {
- http_library= http;
- }
- return http_library;
-};
-
-exports.OAuth2.prototype._request= function(method, url, headers, post_body, access_token, callback) {
-
- var parsedUrl= URL.parse( url, true );
- if( parsedUrl.protocol == "https:" && !parsedUrl.port ) {
- parsedUrl.port= 443;
- }
-
- var http_library= this._chooseHttpLibrary( parsedUrl );
-
-
- var realHeaders= {};
- for( var key in this._customHeaders ) {
- realHeaders[key]= this._customHeaders[key];
- }
- if( headers ) {
- for(var key in headers) {
- realHeaders[key] = headers[key];
- }
- }
- realHeaders['Host']= parsedUrl.host;
-
- if (!realHeaders['User-Agent']) {
- realHeaders['User-Agent'] = 'Node-oauth';
- }
-
- if( post_body ) {
- if ( Buffer.isBuffer(post_body) ) {
- realHeaders["Content-Length"]= post_body.length;
- } else {
- realHeaders["Content-Length"]= Buffer.byteLength(post_body);
- }
- } else {
- realHeaders["Content-length"]= 0;
- }
-
- if( access_token && !('Authorization' in realHeaders)) {
- if( ! parsedUrl.query ) parsedUrl.query= {};
- parsedUrl.query[this._accessTokenName]= access_token;
- }
-
- var queryStr= querystring.stringify(parsedUrl.query);
- if( queryStr ) queryStr= "?" + queryStr;
- var options = {
- host:parsedUrl.hostname,
- port: parsedUrl.port,
- path: parsedUrl.pathname + queryStr,
- method: method,
- headers: realHeaders
- };
-
- this._executeRequest( http_library, options, post_body, callback );
-}
-
-exports.OAuth2.prototype._executeRequest= function( http_library, options, post_body, callback ) {
- // Some hosts *cough* google appear to close the connection early / send no content-length header
- // allow this behaviour.
- var allowEarlyClose= OAuthUtils.isAnEarlyCloseHost(options.host);
- var callbackCalled= false;
- function passBackControl( response, result ) {
- if(!callbackCalled) {
- callbackCalled=true;
- if( !(response.statusCode >= 200 && response.statusCode <= 299) && (response.statusCode != 301) && (response.statusCode != 302) ) {
- callback({ statusCode: response.statusCode, data: result });
- } else {
- callback(null, result, response);
- }
- }
- }
-
- var result= "";
-
- var request = http_library.request(options);
- request.on('response', function (response) {
- response.on("data", function (chunk) {
- result+= chunk
- });
- response.on("close", function (err) {
- if( allowEarlyClose ) {
- passBackControl( response, result );
- }
- });
- response.addListener("end", function () {
- passBackControl( response, result );
- });
- });
- request.on('error', function(e) {
- callbackCalled= true;
- callback(e);
- });
-
- if( (options.method == 'POST' || options.method == 'PUT') && post_body ) {
- request.write(post_body);
- }
- request.end();
-}
-
-exports.OAuth2.prototype.getAuthorizeUrl= function( params ) {
- var params= params || {};
- params['client_id'] = this._clientId;
- return this._baseSite + this._authorizeUrl + "?" + querystring.stringify(params);
-}
-
-exports.OAuth2.prototype.getOAuthAccessToken= function(code, params, callback) {
- var params= params || {};
- params['client_id'] = this._clientId;
- params['client_secret'] = this._clientSecret;
- var codeParam = (params.grant_type === 'refresh_token') ? 'refresh_token' : 'code';
- params[codeParam]= code;
-
- var post_data= querystring.stringify( params );
- var post_headers= {
- 'Content-Type': 'application/x-www-form-urlencoded'
- };
-
-
- this._request("POST", this._getAccessTokenUrl(), post_headers, post_data, null, function(error, data, response) {
- if( error ) callback(error);
- else {
- var results;
- try {
- // As of http://tools.ietf.org/html/draft-ietf-oauth-v2-07
- // responses should be in JSON
- results= JSON.parse( data );
- }
- catch(e) {
- // .... However both Facebook + Github currently use rev05 of the spec
- // and neither seem to specify a content-type correctly in their response headers :(
- // clients of these services will suffer a *minor* performance cost of the exception
- // being thrown
- results= querystring.parse( data );
- }
- var access_token= results["access_token"];
- var refresh_token= results["refresh_token"];
- delete results["refresh_token"];
- callback(null, access_token, refresh_token, results); // callback results =-=
- }
- });
-}
-
-// Deprecated
-exports.OAuth2.prototype.getProtectedResource= function(url, access_token, callback) {
- this._request("GET", url, {}, "", access_token, callback );
-}
-
-exports.OAuth2.prototype.get= function(url, access_token, callback) {
- if( this._useAuthorizationHeaderForGET ) {
- var headers= {'Authorization': this.buildAuthHeader(access_token) }
- access_token= null;
- }
- else {
- headers= {};
- }
- this._request("GET", url, headers, "", access_token, callback );
-}
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/sha1.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/sha1.js
deleted file mode 100644
index d73277a..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/sha1.js
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
- * in FIPS 180-1
- * Version 2.2 Copyright Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 1; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_sha1(s) { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); }
-function b64_sha1(s) { return rstr2b64(rstr_sha1(str2rstr_utf8(s))); }
-function any_sha1(s, e) { return rstr2any(rstr_sha1(str2rstr_utf8(s)), e); }
-function hex_hmac_sha1(k, d)
- { return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_sha1(k, d)
- { return rstr2b64(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_sha1(k, d, e)
- { return rstr2any(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function sha1_vm_test()
-{
- return hex_sha1("abc").toLowerCase() == "a9993e364706816aba3e25717850c26c9cd0d89d";
-}
-
-/*
- * Calculate the SHA1 of a raw string
- */
-function rstr_sha1(s)
-{
- return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-SHA1 of a key and some data (raw strings)
- */
-function rstr_hmac_sha1(key, data)
-{
- var bkey = rstr2binb(key);
- if(bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
- return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var remainders = Array();
- var i, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. We stop when the dividend is zero.
- * All remainders are stored for later use.
- */
- while(dividend.length > 0)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[remainders.length] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- /* Append leading zero equivalents */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)))
- for(i = output.length; i < full_length; i++)
- output = encoding[0] + output;
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of big-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binb(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
- return output;
-}
-
-/*
- * Convert an array of big-endian words to a string
- */
-function binb2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Calculate the SHA-1 of an array of big-endian words, and a bit length
- */
-function binb_sha1(x, len)
-{
- /* append padding */
- x[len >> 5] |= 0x80 << (24 - len % 32);
- x[((len + 64 >> 9) << 4) + 15] = len;
-
- var w = Array(80);
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- var e = -1009589776;
-
- for(var i = 0; i < x.length; i += 16)
- {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- var olde = e;
-
- for(var j = 0; j < 80; j++)
- {
- if(j < 16) w[j] = x[i + j];
- else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
- var t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)),
- safe_add(safe_add(e, w[j]), sha1_kt(j)));
- e = d;
- d = c;
- c = bit_rol(b, 30);
- b = a;
- a = t;
- }
-
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- e = safe_add(e, olde);
- }
- return Array(a, b, c, d, e);
-
-}
-
-/*
- * Perform the appropriate triplet combination function for the current
- * iteration
- */
-function sha1_ft(t, b, c, d)
-{
- if(t < 20) return (b & c) | ((~b) & d);
- if(t < 40) return b ^ c ^ d;
- if(t < 60) return (b & c) | (b & d) | (c & d);
- return b ^ c ^ d;
-}
-
-/*
- * Determine the appropriate additive constant for the current iteration
- */
-function sha1_kt(t)
-{
- return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
- (t < 60) ? -1894007588 : -899497514;
-}
-
-/*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
-function safe_add(x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
-
-/*
- * Bitwise rotate a 32-bit number to the left.
- */
-function bit_rol(num, cnt)
-{
- return (num << cnt) | (num >>> (32 - cnt));
-}
-
-exports.HMACSHA1= function(key, data) {
- return b64_hmac_sha1(key, data);
-} \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/package.json b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/package.json
deleted file mode 100644
index 2d371d2..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/package.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "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.14",
- "directories": {
- "lib": "./lib"
- },
- "main": "index.js",
- "author": {
- "name": "Ciaran Jessup",
- "email": "ciaranj@gmail.com"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/ciaranj/node-oauth.git"
- },
- "devDependencies": {
- "vows": "0.5.x"
- },
- "scripts": {
- "test": "make test"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/ciaranj/node-oauth/raw/master/LICENSE"
- }
- ],
- "gitHead": "eefd821ea9b010a44ba49afa048a421ea23e7502",
- "bugs": {
- "url": "https://github.com/ciaranj/node-oauth/issues"
- },
- "homepage": "https://github.com/ciaranj/node-oauth",
- "_id": "oauth@0.9.14",
- "_shasum": "c5748883a40b53de30ade9cabf2100414b8a0971",
- "_from": "oauth@>=0.9.0 <0.10.0",
- "_npmVersion": "1.4.28",
- "_npmUser": {
- "name": "ciaranj",
- "email": "ciaranj@gmail.com"
- },
- "maintainers": [
- {
- "name": "ciaranj",
- "email": "ciaranj@gmail.com"
- }
- ],
- "dist": {
- "shasum": "c5748883a40b53de30ade9cabf2100414b8a0971",
- "tarball": "https://registry.npmjs.org/oauth/-/oauth-0.9.14.tgz"
- },
- "_resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.14.tgz",
- "readme": "ERROR: No README data found!"
-}
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauth2tests.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauth2tests.js
deleted file mode 100644
index 134f85b..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauth2tests.js
+++ /dev/null
@@ -1,290 +0,0 @@
-var vows = require('vows'),
- assert = require('assert'),
- DummyResponse= require('./shared').DummyResponse,
- DummyRequest= require('./shared').DummyRequest,
- https = require('https'),
- OAuth2= require('../lib/oauth2').OAuth2,
- url = require('url');
-
-vows.describe('OAuth2').addBatch({
- 'Given an OAuth2 instance with clientId and clientSecret, ': {
- topic: new OAuth2("clientId", "clientSecret"),
- 'When dealing with the response from the OP': {
- 'we should treat a 201 response as a success': function(oa) {
- var callbackCalled= false;
- var http_library= {
- request: function() {
- return new DummyRequest(new DummyResponse(201));
- }
- };
- oa._executeRequest( http_library, {}, null, function(err, result, response) {
- callbackCalled= true;
- assert.equal(err, null);
- });
- assert.ok(callbackCalled);
- },
- 'we should treat a 200 response as a success': function(oa) {
- var callbackCalled= false;
- var http_library= {
- request: function() {
- return new DummyRequest(new DummyResponse(200));
- }
- };
- oa._executeRequest( http_library, {}, null, function(err, result, response) {
- callbackCalled= true;
- assert.equal(err, null);
- });
- assert.ok(callbackCalled);
- }
- },
- 'When handling the access token response': {
- 'we should correctly extract the token if received as form-data': function (oa) {
- oa._request= function( method, url, fo, bar, bleh, callback) {
- callback(null, "access_token=access&refresh_token=refresh");
- };
- oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) {
- assert.equal( access_token, "access");
- assert.equal( refresh_token, "refresh");
- });
- },
- 'we should not include access token in both querystring and headers (favours headers if specified)': function (oa) {
- oa._request = new OAuth2("clientId", "clientSecret")._request.bind(oa);
- oa._executeRequest= function( http_library, options, post_body, callback) {
- callback(null, url.parse(options.path, true).query, options.headers);
- };
-
- oa._request("GET", "http://foo/", {"Authorization":"Bearer BadNews"}, null, "accessx", function(error, query, headers) {
- assert.ok( !('access_token' in query), "access_token also in query");
- assert.ok( 'Authorization' in headers, "Authorization not in headers");
- });
- },
- 'we should include access token in the querystring if no Authorization header present to override it': function (oa) {
- oa._request = new OAuth2("clientId", "clientSecret")._request.bind(oa);
- oa._executeRequest= function( http_library, options, post_body, callback) {
- callback(null, url.parse(options.path, true).query, options.headers);
- };
- oa._request("GET", "http://foo/", {}, null, "access", function(error, query, headers) {
- assert.ok( 'access_token' in query, "access_token not present in query");
- assert.ok( !('Authorization' in headers), "Authorization in headers");
- });
- },
- 'we should correctly extract the token if received as a JSON literal': function (oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- callback(null, '{"access_token":"access","refresh_token":"refresh"}');
- };
- oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token) {
- assert.equal( access_token, "access");
- assert.equal( refresh_token, "refresh");
- });
- },
- 'we should return the received data to the calling method': function (oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- callback(null, '{"access_token":"access","refresh_token":"refresh","extra_1":1, "extra_2":"foo"}');
- };
- oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token, results) {
- assert.equal( access_token, "access");
- assert.equal( refresh_token, "refresh");
- assert.isNotNull( results );
- assert.equal( results.extra_1, 1);
- assert.equal( results.extra_2, "foo");
- });
- }
- },
- 'When no grant_type parameter is specified': {
- 'we should pass the value of the code argument as the code parameter': function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.isTrue( post_body.indexOf("code=xsds23") != -1 );
- };
- oa.getOAuthAccessToken("xsds23", {} );
- }
- },
- 'When an invalid grant_type parameter is specified': {
- 'we should pass the value of the code argument as the code parameter': function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.isTrue( post_body.indexOf("code=xsds23") != -1 );
- };
- oa.getOAuthAccessToken("xsds23", {grant_type:"refresh_toucan"} );
- }
- },
- 'When a grant_type parameter of value "refresh_token" is specified': {
- 'we should pass the value of the code argument as the refresh_token parameter, should pass a grant_type parameter, but shouldn\'t pass a code parameter' : function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.isTrue( post_body.indexOf("refresh_token=sdsds2") != -1 );
- assert.isTrue( post_body.indexOf("grant_type=refresh_token") != -1 );
- assert.isTrue( post_body.indexOf("code=") == -1 );
- };
- oa.getOAuthAccessToken("sdsds2", {grant_type:"refresh_token"} );
- }
- },
- 'When we use the authorization header': {
- 'and call get with the default authorization method': {
- 'we should pass the authorization header with Bearer method and value of the access_token, _request should be passed a null access_token' : function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.equal(headers["Authorization"], "Bearer abcd5");
- assert.isNull( access_token );
- };
- oa.useAuthorizationHeaderforGET(true);
- oa.get("", "abcd5");
- }
- },
- 'and call get with the authorization method set to Basic': {
- 'we should pass the authorization header with Basic method and value of the access_token, _request should be passed a null access_token' : function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.equal(headers["Authorization"], "Basic cdg2");
- assert.isNull( access_token );
- };
- oa.useAuthorizationHeaderforGET(true);
- oa.setAuthMethod("Basic");
- oa.get("", "cdg2");
- }
- }
- },
- 'When we do not use the authorization header': {
- 'and call get': {
- 'we should pass NOT provide an authorization header and the access_token should be being passed to _request' : function(oa) {
- oa._request= function(method, url, headers, post_body, access_token, callback) {
- assert.isUndefined(headers["Authorization"]);
- assert.equal( access_token, "abcd5" );
- };
- oa.useAuthorizationHeaderforGET(false);
- oa.get("", "abcd5");
- }
- }
- }
- },
- 'Given an OAuth2 instance with clientId, clientSecret and customHeaders': {
- topic: new OAuth2("clientId", "clientSecret", undefined, undefined, undefined,
- { 'SomeHeader': '123' }),
- 'When GETing': {
- 'we should see the custom headers mixed into headers property in options passed to http-library' : function(oa) {
- oa._executeRequest= function( http_library, options, callback ) {
- assert.equal(options.headers["SomeHeader"], "123");
- };
- oa.get("", {});
- },
- }
- },
- 'Given an OAuth2 instance with a clientId and clientSecret': {
- topic: new OAuth2("clientId", "clientSecret"),
- 'When POSTing': {
- 'we should see a given string being sent to the request' : function(oa) {
- var bodyWritten= false;
- oa._chooseHttpLibrary= function() {
- return {
- request: function(options) {
- assert.equal(options.headers["Content-Type"], "text/plain");
- assert.equal(options.headers["Content-Length"], 26);
- assert.equal(options.method, "POST");
- return {
- end: function() {},
- on: function() {},
- write: function(body) {
- bodyWritten= true;
- assert.isNotNull(body);
- assert.equal(body, "THIS_IS_A_POST_BODY_STRING")
- }
- }
- }
- };
- }
- oa._request("POST", "", {"Content-Type":"text/plain"}, "THIS_IS_A_POST_BODY_STRING");
- assert.ok( bodyWritten );
- },
- 'we should see a given buffer being sent to the request' : function(oa) {
- var bodyWritten= false;
- oa._chooseHttpLibrary= function() {
- return {
- request: function(options) {
- assert.equal(options.headers["Content-Type"], "application/octet-stream");
- assert.equal(options.headers["Content-Length"], 4);
- assert.equal(options.method, "POST");
- return {
- end: function() {},
- on: function() {},
- write: function(body) {
- bodyWritten= true;
- assert.isNotNull(body);
- assert.equal(4, body.length)
- }
- }
- }
- };
- }
- oa._request("POST", "", {"Content-Type":"application/octet-stream"}, new Buffer([1,2,3,4]));
- assert.ok( bodyWritten );
- }
- },
- 'When PUTing': {
- 'we should see a given string being sent to the request' : function(oa) {
- var bodyWritten= false;
- oa._chooseHttpLibrary= function() {
- return {
- request: function(options) {
- assert.equal(options.headers["Content-Type"], "text/plain");
- assert.equal(options.headers["Content-Length"], 25);
- assert.equal(options.method, "PUT");
- return {
- end: function() {},
- on: function() {},
- write: function(body) {
- bodyWritten= true;
- assert.isNotNull(body);
- assert.equal(body, "THIS_IS_A_PUT_BODY_STRING")
- }
- }
- }
- };
- }
- oa._request("PUT", "", {"Content-Type":"text/plain"}, "THIS_IS_A_PUT_BODY_STRING");
- assert.ok( bodyWritten );
- },
- 'we should see a given buffer being sent to the request' : function(oa) {
- var bodyWritten= false;
- oa._chooseHttpLibrary= function() {
- return {
- request: function(options) {
- assert.equal(options.headers["Content-Type"], "application/octet-stream");
- assert.equal(options.headers["Content-Length"], 4);
- assert.equal(options.method, "PUT");
- return {
- end: function() {},
- on: function() {},
- write: function(body) {
- bodyWritten= true;
- assert.isNotNull(body);
- assert.equal(4, body.length)
- }
- }
- }
- };
- }
- oa._request("PUT", "", {"Content-Type":"application/octet-stream"}, new Buffer([1,2,3,4]));
- assert.ok( bodyWritten );
- }
- }
- },
- 'When the user passes in the User-Agent in customHeaders': {
- topic: new OAuth2("clientId", "clientSecret", undefined, undefined, undefined,
- { 'User-Agent': '123Agent' }),
- 'When calling get': {
- 'we should see the User-Agent mixed into headers property in options passed to http-library' : function(oa) {
- oa._executeRequest= function( http_library, options, callback ) {
- assert.equal(options.headers["User-Agent"], "123Agent");
- };
- oa.get("", {});
- }
- }
- },
- 'When the user does not pass in a User-Agent in customHeaders': {
- topic: new OAuth2("clientId", "clientSecret", undefined, undefined, undefined,
- undefined),
- 'When calling get': {
- 'we should see the default User-Agent mixed into headers property in options passed to http-library' : function(oa) {
- oa._executeRequest= function( http_library, options, callback ) {
- assert.equal(options.headers["User-Agent"], "Node-oauth");
- };
- oa.get("", {});
- }
- }
- }
-}).export(module);
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauthtests.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauthtests.js
deleted file mode 100644
index d36bfed..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/oauthtests.js
+++ /dev/null
@@ -1,1064 +0,0 @@
-var vows = require('vows'),
- assert = require('assert'),
- DummyResponse= require('./shared').DummyResponse,
- DummyRequest= require('./shared').DummyRequest,
- events = require('events'),
- OAuth= require('../lib/oauth').OAuth,
- OAuthEcho= require('../lib/oauth').OAuthEcho,
- crypto = require('crypto');
-
-//Valid RSA keypair used to test RSA-SHA1 signature method
-var RsaPrivateKey = "-----BEGIN RSA PRIVATE KEY-----\n" +
-"MIICXQIBAAKBgQDizE4gQP5nPQhzof/Vp2U2DDY3UY/Gxha2CwKW0URe7McxtnmE\n" +
-"CrZnT1n/YtfrrCNxY5KMP4o8hMrxsYEe05+1ZGFT68ztms3puUxilU5E3BQMhz1t\n" +
-"JMJEGcTt8nZUlM4utli7fHgDtWbhvqvYjRMGn3AjyLOfY8XZvnFkGjipvQIDAQAB\n" +
-"AoGAKgk6FcpWHOZ4EY6eL4iGPt1Gkzw/zNTcUsN5qGCDLqDuTq2Gmk2t/zn68VXt\n" +
-"tVXDf/m3qN0CDzOBtghzaTZKLGhnSewQ98obMWgPcvAsb4adEEeW1/xigbMiaW2X\n" +
-"cu6GhZxY16edbuQ40LRrPoVK94nXQpj8p7w4IQ301Sm8PSECQQD1ZlOj4ugvfhEt\n" +
-"exi4WyAaM45fylmN290UXYqZ8SYPI/VliDytIlMfyq5Rv+l+dud1XDPrWOQ0ImgV\n" +
-"HJn7uvoZAkEA7JhHNmHF9dbdF9Koj86K2Cl6c8KUu7U7d2BAuB6pPkt8+D8+y4St\n" +
-"PaCmN4oP4X+sf5rqBYoXywHlqEei2BdpRQJBAMYgR4cZu7wcXGIL8HlnmROObHSK\n" +
-"OqN9z5CRtUV0nPW8YnQG+nYOMG6KhRMbjri750OpnYF100kEPmRNI0VKQIECQE8R\n" +
-"fQsRleTYz768ahTVQ9WF1ySErMwmfx8gDcD6jjkBZVxZVpURXAwyehopi7Eix/VF\n" +
-"QlxjkBwKIEQi3Ks297kCQQCL9by1bueKDMJO2YX1Brm767pkDKkWtGfPS+d3xMtC\n" +
-"KJHHCqrS1V+D5Q89x5wIRHKxE5UMTc0JNa554OxwFORX\n" +
-"-----END RSA PRIVATE KEY-----";
-
-var RsaPublicKey = "-----BEGIN PUBLIC KEY-----\n" +
-"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDizE4gQP5nPQhzof/Vp2U2DDY3\n" +
-"UY/Gxha2CwKW0URe7McxtnmECrZnT1n/YtfrrCNxY5KMP4o8hMrxsYEe05+1ZGFT\n" +
-"68ztms3puUxilU5E3BQMhz1tJMJEGcTt8nZUlM4utli7fHgDtWbhvqvYjRMGn3Aj\n" +
-"yLOfY8XZvnFkGjipvQIDAQAB\n" +
-"-----END PUBLIC KEY-----";
-
-vows.describe('OAuth').addBatch({
- 'When newing OAuth': {
- topic: new OAuth(null, null, null, null, null, null, "PLAINTEXT"),
- 'followRedirects is enabled by default': function (oa) {
- assert.equal(oa._clientOptions.followRedirects, true)
- }
- },
- 'When generating the signature base string described in http://oauth.net/core/1.0/#sig_base_example': {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'we get the expected result string': function (oa) {
- var result= oa._createSignatureBase("GET", "http://photos.example.net/photos",
- "file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk&oauth_version=1.0&size=original")
- assert.equal( result, "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal");
- }
- },
- 'When generating the signature with RSA-SHA1': {
- topic: new OAuth(null, null, null, RsaPrivateKey, null, null, "RSA-SHA1"),
- 'we get a valid oauth signature': function (oa) {
- var signatureBase = "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal";
- var oauthSignature = oa._createSignature(signatureBase, "xyz4992k83j47x0b");
-
- assert.equal( oauthSignature, "qS4rhWog7GPgo4ZCJvUdC/1ZAax/Q4Ab9yOBvgxSopvmKUKp5rso+Zda46GbyN2hnYDTiA/g3P/d/YiPWa454BEBb/KWFV83HpLDIoqUUhJnlXX9MqRQQac0oeope4fWbGlfTdL2PXjSFJmvfrzybERD/ZufsFtVrQKS3QBpYiw=");
-
- //now check that given the public key we can verify this signature
- var verifier = crypto.createVerify("RSA-SHA1").update(signatureBase);
- var valid = verifier.verify(RsaPublicKey, oauthSignature, 'base64');
- assert.ok( valid, "Signature could not be verified with RSA public key");
- }
- },
- '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': {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'default ports should be stripped': function(oa) {
- assert.equal( oa._normalizeUrl("https://somehost.com:443/foo/bar"), "https://somehost.com/foo/bar" );
- },
- 'should leave in non-default ports from urls for use in signature generation': function(oa) {
- assert.equal( oa._normalizeUrl("https://somehost.com:446/foo/bar"), "https://somehost.com:446/foo/bar" );
- assert.equal( oa._normalizeUrl("http://somehost.com:81/foo/bar"), "http://somehost.com:81/foo/bar" );
- },
- 'should add a trailing slash when no path at all is present': function(oa) {
- assert.equal( oa._normalizeUrl("http://somehost.com"), "http://somehost.com/")
- }
- },
- 'When making an array out of the arguments hash' : {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'flatten out arguments that are arrays' : function(oa) {
- var parameters= {"z": "a",
- "a": ["1", "2"],
- "1": "c" };
- var parameterResults= oa._makeArrayOfArgumentsHash(parameters);
- assert.equal(parameterResults.length, 4);
- assert.equal(parameterResults[0][0], "1");
- assert.equal(parameterResults[1][0], "z");
- assert.equal(parameterResults[2][0], "a");
- assert.equal(parameterResults[3][0], "a");
- }
- },
- 'When ordering the request parameters' : {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'Order them by name' : function(oa) {
- var parameters= {"z": "a",
- "a": "b",
- "1": "c" };
- var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters))
- assert.equal(parameterResults[0][0], "1");
- assert.equal(parameterResults[1][0], "a");
- assert.equal(parameterResults[2][0], "z");
- },
- 'If two parameter names are the same then order by the value': function(oa) {
- var parameters= {"z": "a",
- "a": ["z", "b", "b", "a", "y"],
- "1": "c" };
- var parameterResults= oa._sortRequestParams(oa._makeArrayOfArgumentsHash(parameters))
- assert.equal(parameterResults[0][0], "1");
- assert.equal(parameterResults[1][0], "a");
- assert.equal(parameterResults[1][1], "a");
- assert.equal(parameterResults[2][0], "a");
- assert.equal(parameterResults[2][1], "b");
- assert.equal(parameterResults[3][0], "a");
- assert.equal(parameterResults[3][1], "b");
- assert.equal(parameterResults[4][0], "a");
- assert.equal(parameterResults[4][1], "y");
- assert.equal(parameterResults[5][0], "a");
- assert.equal(parameterResults[5][1], "z");
- assert.equal(parameterResults[6][0], "z");
- }
- },
- 'When normalising the request parameters': {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'the resulting parameters should be encoded and ordered as per http://tools.ietf.org/html/rfc5849#section-3.1 (3.4.1.3.2)' : function(oa) {
- var parameters= {"b5" : "=%3D",
- "a3": ["a", "2 q"],
- "c@": "",
- "a2": "r b",
- "oauth_consumer_key": "9djdj82h48djs9d2",
- "oauth_token":"kkk9d7dh3k39sjv7",
- "oauth_signature_method": "HMAC-SHA1",
- "oauth_timestamp": "137131201",
- "oauth_nonce": "7d8f3e4a",
- "c2" : ""};
- var normalisedParameterString= oa._normaliseRequestParams(parameters);
- assert.equal(normalisedParameterString, "a2=r%20b&a3=2%20q&a3=a&b5=%3D%253D&c%40=&c2=&oauth_consumer_key=9djdj82h48djs9d2&oauth_nonce=7d8f3e4a&oauth_signature_method=HMAC-SHA1&oauth_timestamp=137131201&oauth_token=kkk9d7dh3k39sjv7");
- }
- },
- 'When preparing the parameters for use in signing': {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'We need to be wary of node\'s auto object creation from foo[bar] style url parameters' : function(oa) {
- var result= oa._prepareParameters( "", "", "", "http://foo.com?foo[bar]=xxx&bar[foo]=yyy", {} );
- assert.equal( result[0][0], "bar[foo]")
- assert.equal( result[0][1], "yyy")
- assert.equal( result[1][0], "foo[bar]")
- assert.equal( result[1][1], "xxx")
- }
- },
- 'When signing a url': {
- topic: function() {
- var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
- oa._getTimestamp= function(){ return "1272399856"; }
- oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
- return oa;
- },
- 'Provide a valid signature when no token present': function(oa) {
- assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_version=1.0&oauth_signature=7ytO8vPSLut2GzHjU9pn1SV9xjc%3D");
- },
- 'Provide a valid signature when a token is present': function(oa) {
- assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token"), "http://somehost.com:3323/foo/poop?bar=foo&oauth_consumer_key=consumerkey&oauth_nonce=ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1272399856&oauth_token=token&oauth_version=1.0&oauth_signature=9LwCuCWw5sURtpMroIolU3YwsdI%3D");
- },
- 'Provide a valid signature when a token and a token secret is present': function(oa) {
- assert.equal( oa.signUrl("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), "http://somehost.com:3323/foo/poop?bar=foo&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");
- }
- },
- 'When getting a request token': {
- topic: function() {
- var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
- oa._getTimestamp= function(){ return "1272399856"; }
- oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
- oa._performSecureRequest= function(){ return this.requestArguments = arguments; }
- return oa;
- },
- 'Use the HTTP method in the client options': function(oa) {
- oa.setClientOptions({ requestTokenHttpMethod: "GET" });
- oa.getOAuthRequestToken(function() {});
- assert.equal(oa.requestArguments[2], "GET");
- },
- 'Use a POST by default': function(oa) {
- oa.setClientOptions({});
- oa.getOAuthRequestToken(function() {});
- assert.equal(oa.requestArguments[2], "POST");
- }
- },
- 'When getting an access token': {
- topic: function() {
- var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
- oa._getTimestamp= function(){ return "1272399856"; }
- oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
- oa._performSecureRequest= function(){ return this.requestArguments = arguments; }
- return oa;
- },
- 'Use the HTTP method in the client options': function(oa) {
- oa.setClientOptions({ accessTokenHttpMethod: "GET" });
- oa.getOAuthAccessToken(function() {});
- assert.equal(oa.requestArguments[2], "GET");
- },
- 'Use a POST by default': function(oa) {
- oa.setClientOptions({});
- oa.getOAuthAccessToken(function() {});
- assert.equal(oa.requestArguments[2], "POST");
- }
- },
- 'When get authorization header' : {
- topic: function() {
- var oa= new OAuth(null, null, "consumerkey", "consumersecret", "1.0", null, "HMAC-SHA1");
- oa._getTimestamp= function(){ return "1272399856"; }
- oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
- return oa;
- },
- 'Provide a valid signature when a token and a token secret is present': function(oa) {
- 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"');
- }
- },
- 'When get the OAuth Echo authorization header': {
- topic: function () {
- var realm = "http://foobar.com/";
- var verifyCredentials = "http://api.foobar.com/verify.json";
- var oa = new OAuthEcho(realm, verifyCredentials, "consumerkey", "consumersecret", "1.0A", "HMAC-SHA1");
- oa._getTimestamp= function(){ return "1272399856"; }
- oa._getNonce= function(){ return "ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp"; }
- return oa;
- },
- 'Provide a valid signature when a token and token secret is present': function (oa) {
- assert.equal( oa.authHeader("http://somehost.com:3323/foo/poop?bar=foo", "token", "tokensecret"), 'OAuth realm="http://foobar.com/",oauth_consumer_key="consumerkey",oauth_nonce="ybHPeOEkAUJ3k2wJT9Xb43MjtSgTvKqp",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1272399856",oauth_token="token",oauth_version="1.0A",oauth_signature="0rr1LhSxACX2IEWRq3uCb4IwtOs%3D"');
- }
- },
- 'When non standard ports are used': {
- topic: function() {
- var oa= new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- mockProvider= {};
-
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers.Host, "somehost.com:8080");
- assert.equal(hostname, "somehost.com");
- assert.equal(port, "8080");
- return {
- on: function() {},
- end: function() {}
- };
- }
- return oa;
- },
- 'getProtectedResource should correctly define the host headers': function(oa) {
- oa.getProtectedResource("http://somehost.com:8080", "GET", "oauth_token", null, function(){})
- }
- },
- 'When building the OAuth Authorization header': {
- topic: new OAuth(null, null, null, null, null, null, "HMAC-SHA1"),
- 'All provided oauth arguments should be concatentated correctly' : function(oa) {
- var parameters= [
- ["oauth_timestamp", "1234567"],
- ["oauth_nonce", "ABCDEF"],
- ["oauth_version", "1.0"],
- ["oauth_signature_method", "HMAC-SHA1"],
- ["oauth_consumer_key", "asdasdnm2321b3"]];
- assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"');
- },
- '*Only* Oauth arguments should be concatentated, others should be disregarded' : function(oa) {
- var parameters= [
- ["foo", "2343"],
- ["oauth_timestamp", "1234567"],
- ["oauth_nonce", "ABCDEF"],
- ["bar", "dfsdfd"],
- ["oauth_version", "1.0"],
- ["oauth_signature_method", "HMAC-SHA1"],
- ["oauth_consumer_key", "asdasdnm2321b3"],
- ["foobar", "asdasdnm2321b3"]];
- assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"');
- },
- '_buildAuthorizationHeaders should not depends on Array.prototype.toString' : function(oa) {
- var _toString = Array.prototype.toString;
- Array.prototype.toString = function(){ return '[Array] ' + this.length; }; // toString overwrite example used in jsdom.
- var parameters= [
- ["foo", "2343"],
- ["oauth_timestamp", "1234567"],
- ["oauth_nonce", "ABCDEF"],
- ["bar", "dfsdfd"],
- ["oauth_version", "1.0"],
- ["oauth_signature_method", "HMAC-SHA1"],
- ["oauth_consumer_key", "asdasdnm2321b3"],
- ["foobar", "asdasdnm2321b3"]];
- assert.equal(oa._buildAuthorizationHeaders(parameters), 'OAuth oauth_timestamp="1234567",oauth_nonce="ABCDEF",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="asdasdnm2321b3"');
- Array.prototype.toString = _toString;
- }
- },
- 'When performing the Secure Request' : {
- topic: new OAuth("http://foo.com/RequestToken",
- "http://foo.com/AccessToken",
- "anonymous", "anonymous",
- "1.0A", "http://foo.com/callback", "HMAC-SHA1"),
- 'using the POST method' : {
- 'Any passed extra_params should form part of the POST body': function(oa) {
- var post_body_written= false;
- var op= oa._createClient;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return {
- write: function(post_body){
- post_body_written= true;
- assert.equal(post_body,"scope=foobar%2C1%2C2");
- }
- };
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://foo.com/protected_resource', {"scope": "foobar,1,2"});
- assert.equal(post_body_written, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- }
- },
- 'When performing a secure' : {
- topic: new OAuth("http://foo.com/RequestToken",
- "http://foo.com/AccessToken",
- "anonymous", "anonymous",
- "1.0A", "http://foo.com/callback", "HMAC-SHA1"),
- 'POST' : {
- 'if no callback is passed' : {
- 'it should return a request object': function(oa) {
- var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain")
- assert.isObject(request);
- assert.equal(request.method, "POST");
- request.end();
- }
- },
- 'if a callback is passed' : {
- "it should call the internal request's end method and return nothing": function(oa) {
- var callbackCalled= false;
- var op= oa._createClient;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return {
- write: function(){},
- on: function() {},
- end: function() {
- callbackCalled= true;
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){})
- assert.equal(callbackCalled, true);
- assert.isUndefined(request);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is a buffer' : {
- "It should be passed through as is, and the original content-type (if specified) should be passed through": function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "image/jpeg")
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data.length, 4);
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", new Buffer([10,20,30,40]), "image/jpeg")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- },
- "It should be passed through as is, and no content-type is specified.": function(oa) {
- //Should probably actually set application/octet-stream, but to avoid a change in behaviour
- // will just document (here) that the library will set it to application/x-www-form-urlencoded
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded")
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data.length, 4);
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", new Buffer([10,20,30,40]))
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is not a string or a buffer' : {
- "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded")
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"})
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is a string' : {
- "and it contains non ascii (7/8bit) characters" : {
- "the content length should be the byte count, and not the string length" : function(oa) {
- var testString= "Tôi yêu node";
- var testStringLength= testString.length;
- var testStringBytesLength= Buffer.byteLength(testString);
- assert.notEqual(testStringLength, testStringBytesLength); // Make sure we're testing a string that differs between byte-length and char-length!
-
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-length"], testStringBytesLength);
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data, testString);
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", "Tôi yêu node")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- "and no post_content_type is specified" : {
- "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded");
- assert.equal(headers["Content-length"], 23);
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- "and a post_content_type is specified" : {
- "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "unicorn/encoded");
- assert.equal(headers["Content-length"], 23);
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.post("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- }
- }
- },
- 'GET' : {
- 'if no callback is passed' : {
- 'it should return a request object': function(oa) {
- var request= oa.get("http://foo.com/blah", "token", "token_secret")
- assert.isObject(request);
- assert.equal(request.method, "GET");
- request.end();
- }
- },
- 'if a callback is passed' : {
- "it should call the internal request's end method and return nothing": function(oa) {
- var callbackCalled= false;
- var op= oa._createClient;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return {
- on: function() {},
- end: function() {
- callbackCalled= true;
- }
- };
- }
- var request= oa.get("http://foo.com/blah", "token", "token_secret", function(e,d) {})
- assert.equal(callbackCalled, true);
- assert.isUndefined(request);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- },
- 'PUT' : {
- 'if no callback is passed' : {
- 'it should return a request object': function(oa) {
- var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain")
- assert.isObject(request);
- assert.equal(request.method, "PUT");
- request.end();
- }
- },
- 'if a callback is passed' : {
- "it should call the internal request's end method and return nothing": function(oa) {
- var callbackCalled= 0;
- var op= oa._createClient;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return {
- on: function() {},
- write: function(data) {
- callbackCalled++;
- },
- end: function() {
- callbackCalled++;
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", "BLAH", "text/plain", function(e,d){})
- assert.equal(callbackCalled, 2);
- assert.isUndefined(request);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is a buffer' : {
- "It should be passed through as is, and the original content-type (if specified) should be passed through": function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "image/jpeg")
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data.length, 4);
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", new Buffer([10,20,30,40]), "image/jpeg")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- },
- "It should be passed through as is, and no content-type is specified.": function(oa) {
- //Should probably actually set application/octet-stream, but to avoid a change in behaviour
- // will just document (here) that the library will set it to application/x-www-form-urlencoded
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded")
- return {
- write: function(data){
- callbackCalled= true;
- assert.equal(data.length, 4);
- },
- on: function() {},
- end: function() {
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", new Buffer([10,20,30,40]))
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is not a string' : {
- "It should be url encoded and the content type set to be x-www-form-urlencoded" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded")
- return {
- write: function(data) {
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", {"foo":"1,2,3", "bar":"1+2"})
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'if the post_body is a string' : {
- "and no post_content_type is specified" : {
- "It should be written as is, with a content length specified, and the encoding should be set to be x-www-form-urlencoded" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "application/x-www-form-urlencoded");
- assert.equal(headers["Content-length"], 23);
- return {
- write: function(data) {
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- "and a post_content_type is specified" : {
- "It should be written as is, with a content length specified, and the encoding should be set to be as specified" : function(oa) {
- var op= oa._createClient;
- try {
- var callbackCalled= false;
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- assert.equal(headers["Content-Type"], "unicorn/encoded");
- assert.equal(headers["Content-length"], 23);
- return {
- write: function(data) {
- callbackCalled= true;
- assert.equal(data, "foo=1%2C2%2C3&bar=1%2B2");
- }
- };
- }
- var request= oa.put("http://foo.com/blah", "token", "token_secret", "foo=1%2C2%2C3&bar=1%2B2", "unicorn/encoded")
- assert.equal(callbackCalled, true);
- }
- finally {
- oa._createClient= op;
- }
- }
- }
- }
- },
- 'DELETE' : {
- 'if no callback is passed' : {
- 'it should return a request object': function(oa) {
- var request= oa.delete("http://foo.com/blah", "token", "token_secret")
- assert.isObject(request);
- assert.equal(request.method, "DELETE");
- request.end();
- }
- },
- 'if a callback is passed' : {
- "it should call the internal request's end method and return nothing": function(oa) {
- var callbackCalled= false;
- var op= oa._createClient;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return {
- on: function() {},
- end: function() {
- callbackCalled= true;
- }
- };
- }
- var request= oa.delete("http://foo.com/blah", "token", "token_secret", function(e,d) {})
- assert.equal(callbackCalled, true);
- assert.isUndefined(request);
- }
- finally {
- oa._createClient= op;
- }
- }
- }
- },
- 'Request With a Callback' : {
- 'and a 200 response code is received' : {
- 'it should callback successfully' : function(oa) {
- var op= oa._createClient;
- var callbackCalled = false;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse(200) );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(error) {
- // callback
- callbackCalled= true;
- assert.equal(error, undefined);
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'and a 210 response code is received' : {
- 'it should callback successfully' : function(oa) {
- var op= oa._createClient;
- var callbackCalled = false;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse(210) );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(error) {
- // callback
- callbackCalled= true;
- assert.equal(error, undefined);
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'And A 301 redirect is received' : {
- 'and there is a location header' : {
- 'it should (re)perform the secure request but with the new location' : function(oa) {
- var op= oa._createClient;
- var psr= oa._performSecureRequest;
- var responseCounter = 1;
- var callbackCalled = false;
- var DummyResponse =function() {
- if( responseCounter == 1 ){
- this.statusCode= 301;
- this.headers= {location:"http://redirectto.com"};
- responseCounter++;
- }
- else {
- this.statusCode= 200;
- }
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) {
- if( responseCounter == 1 ) {
- assert.equal(url, "http://originalurl.com");
- }
- else {
- assert.equal(url, "http://redirectto.com");
- }
- return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback )
- }
-
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function() {
- // callback
- assert.equal(responseCounter, 2);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- oa._performSecureRequest= psr;
- }
- }
- },
- 'but there is no location header' : {
- 'it should execute the callback, passing the HTTP Response code' : function(oa) {
- var op= oa._createClient;
- var callbackCalled = false;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse(301) );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(error) {
- // callback
- assert.equal(error.statusCode, 301);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'and followRedirect is true' : {
- 'it should (re)perform the secure request but with the new location' : function(oa) {
- var op= oa._createClient;
- var psr= oa._performSecureRequest;
- var responseCounter = 1;
- var callbackCalled = false;
- var DummyResponse =function() {
- if( responseCounter == 1 ){
- this.statusCode= 301;
- this.headers= {location:"http://redirectto.com"};
- responseCounter++;
- }
- else {
- this.statusCode= 200;
- }
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) {
- if( responseCounter == 1 ) {
- assert.equal(url, "http://originalurl.com");
- }
- else {
- assert.equal(url, "http://redirectto.com");
- }
- return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback )
- }
-
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function() {
- // callback
- assert.equal(responseCounter, 2);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- oa._performSecureRequest= psr;
- }
- }
- },
- 'and followRedirect is false' : {
- 'it should not perform the secure request with the new location' : function(oa) {
- var op= oa._createClient;
- oa.setClientOptions({ followRedirects: false });
- var DummyResponse =function() {
- this.statusCode= 301;
- this.headers= {location:"http://redirectto.com"};
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(res, data, response) {
- // callback
- assert.equal(res.statusCode, 301);
- });
- }
- finally {
- oa._createClient= op;
- oa.setClientOptions({followRedirects:true});
- }
- }
- }
- },
- 'And A 302 redirect is received' : {
- 'and there is a location header' : {
- 'it should (re)perform the secure request but with the new location' : function(oa) {
- var op= oa._createClient;
- var psr= oa._performSecureRequest;
- var responseCounter = 1;
- var callbackCalled = false;
- var DummyResponse =function() {
- if( responseCounter == 1 ){
- this.statusCode= 302;
- this.headers= {location:"http://redirectto.com"};
- responseCounter++;
- }
- else {
- this.statusCode= 200;
- }
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) {
- if( responseCounter == 1 ) {
- assert.equal(url, "http://originalurl.com");
- }
- else {
- assert.equal(url, "http://redirectto.com");
- }
- return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback )
- }
-
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function() {
- // callback
- assert.equal(responseCounter, 2);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- oa._performSecureRequest= psr;
- }
- }
- },
- 'but there is no location header' : {
- 'it should execute the callback, passing the HTTP Response code' : function(oa) {
- var op= oa._createClient;
- var callbackCalled = false;
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse(302) );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(error) {
- // callback
- assert.equal(error.statusCode, 302);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- }
- }
- },
- 'and followRedirect is true' : {
- 'it should (re)perform the secure request but with the new location' : function(oa) {
- var op= oa._createClient;
- var psr= oa._performSecureRequest;
- var responseCounter = 1;
- var callbackCalled = false;
- var DummyResponse =function() {
- if( responseCounter == 1 ){
- this.statusCode= 302;
- this.headers= {location:"http://redirectto.com"};
- responseCounter++;
- }
- else {
- this.statusCode= 200;
- }
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest= function( oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback ) {
- if( responseCounter == 1 ) {
- assert.equal(url, "http://originalurl.com");
- }
- else {
- assert.equal(url, "http://redirectto.com");
- }
- return psr.call(oa, oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback )
- }
-
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function() {
- // callback
- assert.equal(responseCounter, 2);
- callbackCalled= true;
- });
- assert.equal(callbackCalled, true)
- }
- finally {
- oa._createClient= op;
- oa._performSecureRequest= psr;
- }
- }
- },
- 'and followRedirect is false' : {
- 'it should not perform the secure request with the new location' : function(oa) {
- var op= oa._createClient;
- oa.setClientOptions({ followRedirects: false });
- var DummyResponse =function() {
- this.statusCode= 302;
- this.headers= {location:"http://redirectto.com"};
- }
- DummyResponse.prototype= events.EventEmitter.prototype;
- DummyResponse.prototype.setEncoding= function() {}
-
- try {
- oa._createClient= function( port, hostname, method, path, headers, sshEnabled ) {
- return new DummyRequest( new DummyResponse() );
- }
- oa._performSecureRequest("token", "token_secret", 'POST', 'http://originalurl.com', {"scope": "foobar,1,2"}, null, null, function(res, data, response) {
- // callback
- assert.equal(res.statusCode, 302);
- });
- }
- finally {
- oa._createClient= op;
- oa.setClientOptions({followRedirects:true});
- }
- }
- }
- }
- }
- }
-}).export(module);
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/sha1tests.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/sha1tests.js
deleted file mode 100644
index 18ba0ae..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/sha1tests.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var vows = require('vows'),
- assert = require('assert');
-
-vows.describe('SHA1 Hashing').addBatch({
- 'When using the SHA1 Hashing function': {
- topic: require('../lib/sha1'),
- 'we get the specified digest as described in http://oauth.net/core/1.0/#sig_base_example (A.5.2)': function (sha1) {
- assert.equal (sha1.HMACSHA1( "kd94hf93k423kf44&pfkkdhi9sl3r4s00",
- "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"),
- "tR3+Ty81lMeYAr/Fid0kMTYa/WM=");
- }
- }
-}).export(module); \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/shared.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/shared.js
deleted file mode 100644
index f4c8094..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/tests/shared.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var events = require('events');
-
-exports.DummyResponse = function( statusCode ) {
- this.statusCode= statusCode;
- this.headers= {};
-}
-exports.DummyResponse.prototype= events.EventEmitter.prototype;
-exports.DummyResponse.prototype.setEncoding= function() {}
-
-exports.DummyRequest =function( response ) {
- this.response= response;
- this.responseSent= false;
-}
-exports.DummyRequest.prototype= events.EventEmitter.prototype;
-exports.DummyRequest.prototype.write= function(post_body){}
-exports.DummyRequest.prototype.write= function(post_body){
- this.responseSent= true;
- this.emit('response',this.response);
-}
-exports.DummyRequest.prototype.end= function(){
- if(!this.responseSent) {
- this.responseSent= true;
- this.emit('response',this.response);
- }
- this.response.emit('end');
-} \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.jshintrc b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.jshintrc
deleted file mode 100644
index a07354b..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.jshintrc
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "node": true,
-
- "bitwise": true,
- "camelcase": true,
- "curly": true,
- "forin": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "noempty": true,
- "nonew": true,
- "quotmark": "single",
- "undef": true,
- "unused": true,
- "trailing": true,
-
- "laxcomma": true
-}
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.travis.yml b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.travis.yml
deleted file mode 100644
index 45f8624..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-language: "node_js"
-node_js:
- - "0.4"
- - "0.6"
- - "0.8"
- - "0.10"
-
-before_install:
- - "npm install istanbul -g"
- - "npm install coveralls -g"
-
-script: "make ci-travis"
-
-after_success:
- - "make submit-coverage-to-coveralls"
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/LICENSE b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/LICENSE
deleted file mode 100644
index ec885b5..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2011-2013 Jared Hanson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/README.md b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/README.md
deleted file mode 100644
index 71de07f..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# passport-strategy
-
-[![Build](https://travis-ci.org/jaredhanson/passport-strategy.png)](http://travis-ci.org/jaredhanson/passport-strategy)
-[![Coverage](https://coveralls.io/repos/jaredhanson/passport-strategy/badge.png)](https://coveralls.io/r/jaredhanson/passport-strategy)
-[![Dependencies](https://david-dm.org/jaredhanson/passport-strategy.png)](http://david-dm.org/jaredhanson/passport-strategy)
-
-
-An abstract class implementing [Passport](http://passportjs.org/)'s strategy
-API.
-
-## Install
-
- $ npm install passport-strategy
-
-## Usage
-
-This module exports an abstract `Strategy` class that is intended to be
-subclassed when implementing concrete authentication strategies. Once
-implemented, such strategies can be used by applications that utilize Passport
-middleware for authentication.
-
-#### Subclass Strategy
-
-Create a new `CustomStrategy` constructor which inherits from `Strategy`:
-
-```javascript
-var util = require('util')
- , Strategy = require('passport-strategy');
-
-function CustomStrategy(...) {
- Strategy.call(this);
-}
-
-util.inherits(CustomStrategy, Strategy);
-```
-
-#### Implement Authentication
-
-Implement `autheticate()`, performing the necessary operations required by the
-authentication scheme or protocol being implemented.
-
-```javascript
-CustomStrategy.prototype.authenticate = function(req, options) {
- // TODO: authenticate request
-}
-```
-
-## Tests
-
- $ npm install
- $ npm test
-
-## Credits
-
- - [Jared Hanson](http://github.com/jaredhanson)
-
-## License
-
-[The MIT License](http://opensource.org/licenses/MIT)
-
-Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/index.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/index.js
deleted file mode 100644
index a6fdfa7..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Module dependencies.
- */
-var Strategy = require('./strategy');
-
-
-/**
- * Expose `Strategy` directly from package.
- */
-exports = module.exports = Strategy;
-
-/**
- * Export constructors.
- */
-exports.Strategy = Strategy;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/strategy.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/strategy.js
deleted file mode 100644
index 5a7eb28..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/lib/strategy.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Creates an instance of `Strategy`.
- *
- * @constructor
- * @api public
- */
-function Strategy() {
-}
-
-/**
- * Authenticate request.
- *
- * This function must be overridden by subclasses. In abstract form, it always
- * throws an exception.
- *
- * @param {Object} req The request to authenticate.
- * @param {Object} [options] Strategy-specific options.
- * @api public
- */
-Strategy.prototype.authenticate = function(req, options) {
- throw new Error('Strategy#authenticate must be overridden by subclass');
-};
-
-
-/**
- * Expose `Strategy`.
- */
-module.exports = Strategy;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/package.json b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/package.json
deleted file mode 100644
index 05b9708..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/passport-strategy/package.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "name": "passport-strategy",
- "version": "1.0.0",
- "description": "An abstract class implementing Passport's strategy API.",
- "keywords": [
- "passport",
- "strategy"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/jaredhanson/passport-strategy.git"
- },
- "bugs": {
- "url": "http://github.com/jaredhanson/passport-strategy/issues"
- },
- "author": {
- "name": "Jared Hanson",
- "email": "jaredhanson@gmail.com",
- "url": "http://www.jaredhanson.net/"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/MIT"
- }
- ],
- "main": "./lib",
- "dependencies": {},
- "devDependencies": {
- "mocha": "1.x.x",
- "chai": "1.x.x"
- },
- "engines": {
- "node": ">= 0.4.0"
- },
- "scripts": {
- "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js"
- },
- "testling": {
- "browsers": [
- "chrome/latest"
- ],
- "harness": "mocha",
- "files": [
- "test/bootstrap/testling.js",
- "test/*.test.js"
- ]
- },
- "readme": "# passport-strategy\n\n[![Build](https://travis-ci.org/jaredhanson/passport-strategy.png)](http://travis-ci.org/jaredhanson/passport-strategy)\n[![Coverage](https://coveralls.io/repos/jaredhanson/passport-strategy/badge.png)](https://coveralls.io/r/jaredhanson/passport-strategy)\n[![Dependencies](https://david-dm.org/jaredhanson/passport-strategy.png)](http://david-dm.org/jaredhanson/passport-strategy)\n\n\nAn abstract class implementing [Passport](http://passportjs.org/)'s strategy\nAPI.\n\n## Install\n\n $ npm install passport-strategy\n\n## Usage\n\nThis module exports an abstract `Strategy` class that is intended to be\nsubclassed when implementing concrete authentication strategies. Once\nimplemented, such strategies can be used by applications that utilize Passport\nmiddleware for authentication.\n\n#### Subclass Strategy\n\nCreate a new `CustomStrategy` constructor which inherits from `Strategy`:\n\n```javascript\nvar util = require('util')\n , Strategy = require('passport-strategy');\n\nfunction CustomStrategy(...) {\n Strategy.call(this);\n}\n\nutil.inherits(CustomStrategy, Strategy);\n```\n\n#### Implement Authentication\n\nImplement `autheticate()`, performing the necessary operations required by the\nauthentication scheme or protocol being implemented.\n\n```javascript\nCustomStrategy.prototype.authenticate = function(req, options) {\n // TODO: authenticate request\n}\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
- "readmeFilename": "README.md",
- "_id": "passport-strategy@1.0.0",
- "dist": {
- "shasum": "b5539aa8fc225a3d1ad179476ddf236b440f52e4",
- "tarball": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz"
- },
- "_from": "passport-strategy@>=1.0.0 <2.0.0",
- "_npmVersion": "1.2.25",
- "_npmUser": {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- },
- "maintainers": [
- {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "b5539aa8fc225a3d1ad179476ddf236b440f52e4",
- "_resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
- "homepage": "https://github.com/jaredhanson/passport-strategy#readme"
-}
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/LICENSE b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/LICENSE
deleted file mode 100644
index bdfab69..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Marco Aurelio
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/index.js b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/index.js
deleted file mode 100644
index 6240b30..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Module dependencies
- */
-
-var crypto = require('crypto');
-
-/**
- * 62 characters in the ascii range that can be used in URLs without special
- * encoding.
- */
-var UIDCHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
-
-/**
- * Make a Buffer into a string ready for use in URLs
- *
- * @param {String}
- * @returns {String}
- * @api private
- */
-function tostr(bytes) {
- var chars, r, i;
-
- r = [];
- for (i = 0; i < bytes.length; i++) {
- r.push(UIDCHARS[bytes[i] % UIDCHARS.length]);
- }
-
- return r.join('');
-}
-
-/**
- * Generate an Unique Id
- *
- * @param {Number} length The number of chars of the uid
- * @param {Number} cb (optional) Callback for async uid generation
- * @api public
- */
-
-function uid(length, cb) {
-
- if (typeof cb === 'undefined') {
- return tostr(crypto.pseudoRandomBytes(length));
- } else {
- crypto.pseudoRandomBytes(length, function(err, bytes) {
- if (err) return cb(err);
- cb(null, tostr(bytes));
- })
- }
-}
-
-/**
- * Exports
- */
-
-module.exports = uid;
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/package.json b/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/package.json
deleted file mode 100644
index 68a064b..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/uid2/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "uid2",
- "description": "strong uid",
- "tags": [
- "uid"
- ],
- "version": "0.0.3",
- "dependencies": {},
- "readme": "ERROR: No README data found!",
- "_id": "uid2@0.0.3",
- "dist": {
- "shasum": "483126e11774df2f71b8b639dcd799c376162b82",
- "tarball": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz"
- },
- "_from": "uid2@>=0.0.0 <0.1.0",
- "_npmVersion": "1.2.21",
- "_npmUser": {
- "name": "coreh",
- "email": "thecoreh@gmail.com"
- },
- "maintainers": [
- {
- "name": "coreh",
- "email": "thecoreh@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "483126e11774df2f71b8b639dcd799c376162b82",
- "_resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz"
-}
diff --git a/node_modules/passport-facebook/node_modules/passport-oauth2/package.json b/node_modules/passport-facebook/node_modules/passport-oauth2/package.json
deleted file mode 100644
index 3117907..0000000
--- a/node_modules/passport-facebook/node_modules/passport-oauth2/package.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "name": "passport-oauth2",
- "version": "1.3.0",
- "description": "OAuth 2.0 authentication strategy for Passport.",
- "keywords": [
- "passport",
- "auth",
- "authn",
- "authentication",
- "authz",
- "authorization",
- "oauth",
- "oauth2"
- ],
- "author": {
- "name": "Jared Hanson",
- "email": "jaredhanson@gmail.com",
- "url": "http://www.jaredhanson.net/"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/jaredhanson/passport-oauth2.git"
- },
- "bugs": {
- "url": "http://github.com/jaredhanson/passport-oauth2/issues"
- },
- "license": "MIT",
- "licenses": [
- {
- "type": "MIT",
- "url": "http://opensource.org/licenses/MIT"
- }
- ],
- "main": "./lib",
- "dependencies": {
- "passport-strategy": "1.x.x",
- "oauth": "0.9.x",
- "uid2": "0.0.x"
- },
- "devDependencies": {
- "make-node": "0.3.x",
- "mocha": "2.x.x",
- "chai": "2.x.x",
- "chai-passport-strategy": "1.x.x"
- },
- "engines": {
- "node": ">= 0.4.0"
- },
- "scripts": {
- "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js test/**/*.test.js"
- },
- "gitHead": "1eb4f22d5f6ca8bc6b08856f91779f67e5082fe0",
- "homepage": "https://github.com/jaredhanson/passport-oauth2#readme",
- "_id": "passport-oauth2@1.3.0",
- "_shasum": "d72b4bd62eeb807a4089ff3071a22c26c382dc0c",
- "_from": "passport-oauth2@>=1.0.0 <2.0.0",
- "_npmVersion": "2.14.7",
- "_nodeVersion": "4.2.1",
- "_npmUser": {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- },
- "maintainers": [
- {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- }
- ],
- "dist": {
- "shasum": "d72b4bd62eeb807a4089ff3071a22c26c382dc0c",
- "tarball": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.3.0.tgz"
- },
- "_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/passport-oauth2-1.3.0.tgz_1459305572060_0.39259084430523217"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.3.0.tgz",
- "readme": "ERROR: No README data found!"
-}
diff --git a/node_modules/passport-facebook/package.json b/node_modules/passport-facebook/package.json
deleted file mode 100644
index bad5355..0000000
--- a/node_modules/passport-facebook/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "name": "passport-facebook",
- "version": "2.1.1",
- "description": "Facebook authentication strategy for Passport.",
- "keywords": [
- "passport",
- "facebook",
- "auth",
- "authn",
- "authentication",
- "identity"
- ],
- "author": {
- "name": "Jared Hanson",
- "email": "jaredhanson@gmail.com",
- "url": "http://www.jaredhanson.net/"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/jaredhanson/passport-facebook.git"
- },
- "bugs": {
- "url": "http://github.com/jaredhanson/passport-facebook/issues"
- },
- "license": "MIT",
- "licenses": [
- {
- "type": "MIT",
- "url": "http://opensource.org/licenses/MIT"
- }
- ],
- "main": "./lib",
- "dependencies": {
- "passport-oauth2": "1.x.x"
- },
- "devDependencies": {
- "make-node": "0.3.x",
- "mocha": "1.x.x",
- "chai": "2.x.x",
- "chai-passport-strategy": "1.x.x"
- },
- "engines": {
- "node": ">= 0.4.0"
- },
- "scripts": {
- "test": "mocha --require test/bootstrap/node test/*.test.js"
- },
- "gitHead": "2b74dd0eff976e85b029178e8012cb3703231112",
- "homepage": "https://github.com/jaredhanson/passport-facebook#readme",
- "_id": "passport-facebook@2.1.1",
- "_shasum": "c39d0b52ae4d59163245a4e21a7b9b6321303311",
- "_from": "passport-facebook@>=2.1.1 <3.0.0",
- "_npmVersion": "2.14.7",
- "_nodeVersion": "4.2.1",
- "_npmUser": {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- },
- "maintainers": [
- {
- "name": "jaredhanson",
- "email": "jaredhanson@gmail.com"
- }
- ],
- "dist": {
- "shasum": "c39d0b52ae4d59163245a4e21a7b9b6321303311",
- "tarball": "https://registry.npmjs.org/passport-facebook/-/passport-facebook-2.1.1.tgz"
- },
- "_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/passport-facebook-2.1.1.tgz_1463512414599_0.7715082890354097"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/passport-facebook/-/passport-facebook-2.1.1.tgz",
- "readme": "ERROR: No README data found!"
-}